TimeZone ID's in Java

后端 未结 7 1918
孤街浪徒
孤街浪徒 2020-12-09 09:19

I\'m having weird problem with java TimeZone..

Calling TimeZone.getDefault() gives my local time zone, which has an ID \"GMT+02:00\". Funny thing is

7条回答
  •  庸人自扰
    2020-12-09 09:35

    Joda time has a constant DateTimeZone.UTC. That class or constant might be of help to you. http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTimeZone.html

    Java 8 UPDATE

    Java 8 also now has ZoneOffset.UTC: https://docs.oracle.com/javase/8/docs/api/java/time/ZoneOffset.html#UTC

提交回复
热议问题