SimpleDateFormat parse is one hour out (using RFC 1123, GMT in summer)

末鹿安然 提交于 2019-12-06 00:41:46

I try the first pattern "EEE, dd MMM yyyy HH:mm:ss zzz" and I got this answer

date=Thu Jan 01 01:00:01 CET 1970; 1234
str=Thu, 01 Jan 1970 01:00:01 CET
date2=Thu Jan 01 01:00:01 CET 1970; 1000

I try the second pattern and I got the same answer.

In order to have the same time in both cases I add the missing milliseconds of the transformation to the patter:

pattern = "EEE, dd MMM yyyy HH:mm:ss:SSS Z"

date=Thu Jan 01 01:00:01 CET 1970; 1234
str=Thu, 01 Jan 1970 01:00:01:234 +0100
date2=Thu Jan 01 01:00:01 CET 1970; 1234

GMT does not have daylight saving. Here in the UK, we live by "British Standard Time", which has daylight saving. "Greenwich Mean Time" is the world reference time, which does not have daylight saving. However, Microsoft gets this wrong, which has helped to sow confusion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!