public static void main(String[] args) {
//年
int year = LocalDate.now().getYear();
System.out.println(year);
//月(英文)
Month month = LocalDate.now().getMonth();
System.out.println(month);
//日
int dayOfMonth = LocalDate.now().getDayOfMonth();
System.out.println(dayOfMonth);
//时
int hour = LocalDateTime.now().getHour();
System.out.println(hour);
//分
int minute = LocalDateTime.now().getMinute();
System.out.println(minute);
//秒
int second = LocalDateTime.now().getSecond();
System.out.println(second);
//周几
DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek();
System.out.println(dayOfWeek);
//距离今年第一年的第多少天
int dayOfYear = LocalDate.now().getDayOfYear();
System.out.println(dayOfYear);
//开始时间(精确时分秒)
LocalDateTime todayStart = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIN);
System.out.println(todayStart);
//结束时间(精确时分秒)
LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MAX);
System.out.println(todayEnd);
//LocalDate -> String(两种)
String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(format);
String date = LocalDates.formatLocalDate(LocalDate.now(), YYYYMMDD_PATTERN);
System.out.println(date);
//LocalDateTime -> String
String format1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(format1);
//String -> LocalDate
LocalDate ldt1 = LocalDates.parseLocalDate("2017-09-28","yyyy-MM-dd");
System.out.println(ldt1);
//String -> LocalDateTime
LocalDateTime ldt = LocalDateTime.parse("2017-09-28 17/07/05",DateTimeFormatter.ofPattern("yyyy-MM-dd HH/mm/ss"));
System.out.println(ldt);
}