开发者

uk time zone format for the day light saving

开发者 https://www.devze.com 2023-04-12 00:23 出处:网络
I am using GMT+1 for uk time zone in my code. My problem is for daylight saving it will not wor开发者_StackOverflow社区k. Can i use BST in place of that so that it will automatically take care of the

I am using GMT+1 for uk time zone in my code. My problem is for daylight saving it will not wor开发者_StackOverflow社区k. Can i use BST in place of that so that it will automatically take care of the daylight saving.


No, you should use the time zone identifier of "Europe/London" as that is the time zone observed by the UK. It should then be accurate for both standard time and daylight saving time.

(As a general note, if you're doing any significant date and time work in Java, it's worth checking out Joda Time - a much nicer API than the built-in one.)


assert TimeZone.getTimeZone("BST").getDisplayName().equals("Bangladesh Time");

0

精彩评论

暂无评论...
验证码 换一张
取 消