LocalDateTime格式化

    LocalDateTime time=LocalDateTime.now();

    System.out.println(time);

    DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern(“yyyy-MM-dd HH:mm:ss”);

    String strDate2 = dtf2.format(time);

    System.out.println(strDate2);

    LocalDate转String ,String转LocalDate

    LocalDate data=LocalDate.now();

    System.out.print(data);

    DateTimeFormatter dtf3 = DateTimeFormatter.ofPattern(“yyyy-MM-dd”);

    String strDate3 = dtf3.format(data);

    System.out.println(strDate3);

    strDate3=strDate3+” 04:00:00”;

    LocalDateTime time1=LocalDateTime.parse(strDate3,dtf2);

    System.out.print(time1);

    System.out.print(time.isAfter(time1));