TimeZone ID's in Java

后端 未结 7 1912
孤街浪徒
孤街浪徒 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:47

    Any timezone can be specified as "GMT" plus/minus an offset. The timezone doc refers to this as a "custom ID".

    To populate a drop-down, I think you'd be better off coming up with a specific list of cities/offsets, with an association to the timezone. The array returned by getAvailableIDs() is huge -- 586 entries in my install -- and you definitely don't want to force your users to plod through this.

提交回复
热议问题