Why is subtracting these two times (in 1927) giving a strange result?

前端 未结 10 1160
既然无缘
既然无缘 2020-11-21 08:10

If I run the following program, which parses two date strings referencing times 1 second apart and compares them:

public static void main(String[] args) throw         


        
10条回答
  •  生来不讨喜
    2020-11-21 08:31

    The moral of this strangeness is:

    • Use dates and times in UTC wherever possible.
    • If you can not display a date or time in UTC, always indicate the time-zone.
    • If you can not require an input date/time in UTC, require an explicitly indicated time-zone.

提交回复
热议问题