Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个很长的值,表示从纪元开始的毫秒数,我想知道如何将其作为表示纽约时间的日期(包括是否包含夏令时偏移,对于该特定日期)。我刚刚下载了 JODA,因为我一直在阅读它可能会有所帮助,但我还是有点迷茫。想法?
使用此代码:
new DateTime( millis, DateTimeZone.forID( "America/New_York" ) );
说明:当您指定毫秒时,它们总是相对于时代(1.1.1970)。通过明确设置时区,JodaTime 将在您打印日期时使用该时区。