我在兩個(gè)不同的結(jié)果中得到了“1000-01-01 00:00:00”的時(shí)間戳。有人知道為什么嗎?TimeZone timeZone = TimeZone.getTimeZone(ZoneOffset.UTC);GregorianCalendar calendar = new GregorianCalendar(timeZone);calendar.clear();calendar.set(1000, 0, 1, 0, 0, 0);System.out.println(calendar.getTimeInMillis()); // print -30609792000000System.out.println(ZonedDateTime.of(1000, 1, 1,0, 0, 0, 0, timeZone.toZoneId()).toInstant().toEpochMilli()); // print -30610224000000
Java:如何獲取 UTC 中的“1000-01-01 00:00:00”時(shí)間戳?
www說(shuō)
2023-08-09 16:00:51