简体   繁体   English

英国夏令时格式

[英]uk time zone format for the day light saving

I am using GMT+1 for uk time zone in my code. 我在代码中将GMT + 1用于英国时区。 My problem is for daylight saving it will not work. 我的问题是夏令时不起作用。 Can i use BST in place of that so that it will automatically take care of the daylight saving. 我可以使用BST代替它,这样它将自动处理夏时制。

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.) (作为一般的注意,如果你正在做在Java中任何显著的日期和时间的工作,这是值得一试乔达时间 -比好得多 API内置一个)

断言TimeZone.getTimeZone(“ BST”)。getDisplayName()。equals(“孟加拉国时间”);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM