org.joda.time | Day Light Saving time (DST) and local time zone offset

前端 未结 3 1858
星月不相逢
星月不相逢 2020-12-18 06:14

just to verify this: I have this lame and brain dead method to calculate the time zone offset for my current location. I wonder if I need to adjust it when Day Light Saving

3条回答
  •  爱一瞬间的悲伤
    2020-12-18 06:57

    Normally, Joda time will take care of DST by itself, so you don't have to worry about it. However, I notice that you are passing null to getOffset(). Given that the time zone offset depends on the date, you really should be passing the date/time at which you are calculating the offset, or you're going to get wrong results.

    Also as mentionned in my previous comment: Be aware that some timezones have an offset that isn't a whole number of hours. India for example is at GMT +5:30

提交回复
热议问题