import java.time.LocalDate;
import java.time.LocalDateTime;/*来自 N o w J a v a . c o m*/
import java.time.LocalTime;
import java.time.Month;
public class Main {
public static void main(String[] args) {
// Create a local date and time
LocalDate ld = LocalDate.of(2019, Month.MAY, 11);
LocalTime lt = LocalTime.of(8, 52, 23);
System.out.println("ld: " + ld);
System.out.println("ld.isLeapYear(): " + ld.isLeapYear());
System.out.println("lt: " + lt);
// Create a local datetime from the local date and time
LocalDateTime ldt = LocalDateTime.of(ld, lt);
System.out.println("ldt: " + ldt);
// Add 2 months and 25 minutes to the local datetime
LocalDateTime ldt2 = ldt.plusMonths(2).plusMinutes(25) ;
System.out.println("ldt2: " + ldt2);
/**来自
n o w j a v a . c o m**/
// Derive the local date and time from the localdatetime
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。