且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java:如何在UTC中获取时间戳"1000-01-01 00:00:00"?

更新时间:2022-11-22 13:07:31

GregorianCalendar 尽管其名称使用公历是从1582年开始引入公历之前的时间.相比之下, ZonedDateTime 使用 公历是公历 ,也就是说,将公历推算到当时没有使用过的世纪中.

GregorianCalendar despite its name uses the Julian calendar for the time before the Gregorian calendar was introduced from 1582 and onward. ZonedDateTime by contrast uses the Proleptic Gregorian calendar, that is, extrapolates the Gregorian calendar into the centuries where it wasn’t used at that time.

因此,您实际上使用的是两个日历系统.这就解释了为什么您得到两种不同的结果.

So you are really using two calendar systems. Which explains why you are getting two different results.