Java:使用LocalDateTime和ChronoUnit的时差(以毫秒为单位)
我想计算两个LocalDateTime对象之间的时间差(以毫秒为单位):
LocalDateTime startDate = LocalDateTime.of(2017, 11, 22, 21, 30, 30, 250);
LocalDateTime endDate = LocalDateTime.of(2017, 11, 22, 21, 30, 30, 252);
long diff = ChronoUnit.MILLIS.between(startDate, endDate)
但是,diff 的值不是 2,正如我所期望的那样,而是 0。这是怎么回事?