-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastjson夏令时期间Date转换导致时区错误问题 #1878
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我们发现在使用fastjson(包括最版版本的fastjson)的方法: JSON.toJSONString(date, SerializerFeature.UseISO8601DateFormat) 做Date->String的转换时没有考虑夏令时, 所以会导致在洛杉矶时区中在夏令时期间做此转换会不符合业务预期.
(1)fastjson获取毫秒偏移的方法为:calendar.getTimeZone().getRawOffset(),而getRawOffset()是不考虑夏令时。
(2)javax中的原生方法获取毫秒偏移方法为:calendar.getTimeZone().getOffset(long date),getOffset(long date)方法会考虑夏令时。
具体可以见之前转的邮件"fastjson夏令时期间Date转换导致时区错误问题分析"
The text was updated successfully, but these errors were encountered: