小白篇:JDK8的日期处理API-必知必备(2)
public static LocalDate of(int year, int month, int dayOfMonth) public static LocalDate ofInstant(Instant instant, ZoneId zone) //当天是当月的第几天 public int getDayOfMonth() //当天是当年的第几天 public int getDayOfYear() //当天是当周的第几天(1~7) public DayOfWeek getDayOfWeek() //是否闰年 public boolean isLeapYear() public LocalDateTime atTime(LocalTime time) //设置时间为今天的凌晨 public LocalDateTime atStartOfDay() //以下两个方法是jdk9,获取当前时间到endExclusive的每一个日期 public Stream<LocalDate> datesUntil(LocalDate endExclusive) public Stream<LocalDate> datesUntil(LocalDate endExclusive, Period step) (编辑:ASP站长网) |