Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

14.6. Period :基于日期值

对比时间

		
Period fromUnits = Period.of(3, 10, 10);
Period fromDays = Period.ofDays(50);
Period fromMonths = Period.ofMonths(5);
Period fromYears = Period.ofYears(10);
Period fromWeeks = Period.ofWeeks(40);
		
		
		
LocalDate start = LocalDate.of(2019,9,25);
LocalDate end = LocalDate.of(2019,9,29);
Period period = Period.between(start, end);
System.out.println("相差天数="+period.getDays());