-
Notifications
You must be signed in to change notification settings - Fork 25
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
Strange timezone offsets #8
Comments
Could you append the below code into your main, and rerun it? System.out.println(OffsetDateTime.now()); it could print the JVM's ZoneOffset, like this: |
2020-08-04T09:14:42.263+02:00 |
I have a similar problem when parsed time with time zone offset is shown with 1h difference between parsed time and expected time. The difference seems to be related toDST. I think the problem is in local time zone. Actually my time zone is in Daylight saving time (DST). Normally my local time zone is -05:00 (standard time), but in summer we have 1h shift for DST(Daylight saving time). So during summer my local time zone is -04:00. The problem is that when date with time zone is parsed, my local time zone is applied in dateTime.toEpochSecond(DEFAULT_OFFSET); when parsed result is converted to Date object (in DateBuilder.java) If I disable DST in my system, then the parsed result has expected value. |
Thanks for your explanation and the PR. I have merged your PullRequest#22 and deploy an new version |
Hi,
public static void main(String[] args) {
final DateParser dp = DateParser.newBuilder().build();
final String date = "2020-06-08T13:45:05-00:00";
System.out.println(dp.parseDate(date).toString());
System.out.println(dp.parseDateTime(date).toString());
System.out.println(dp.parseOffsetDateTime(date).toString());
}
The code above gives me the results:
Mon Jun 08 14:45:05 CEST 2020
2020-06-08T14:45:05
2020-06-08T13:45:05Z
My local time was 13:45:05 I'm using GMT+2.
I expected to get something like 15:45:05 (13:45:05 + 2 hours)
Am I doing something wrong?
Version 1.0.2-1.0.4
Version 1.0.0-1.0.1
Gives me the following:
Mon Jun 08 15:45:05 CEST 2020
2020-06-08T15:45:05
2020-06-08T13:45:05Z
The text was updated successfully, but these errors were encountered: