-
Notifications
You must be signed in to change notification settings - Fork 18k
time: local timezone affects parsing RFC1123 #16517
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
Comments
This behavior is observed downstream SlyMarbo/rss#33 |
timezone abbreviation is only meaningful within a certain
location.
You need to parse the date within the location that have
valid timezone called PDT.
This is working as intended.
|
@minux can you explain this behavior further? I also tried time.ParseInLocation with time.LoadLocation("Americas/Los Angeles") but still with the same behavior. How do I properly parse that time string to get the expected result consistently? |
Duh! Bad typos in my location, it's working fine. Thanks! I still don't understand your statement though: "timezone abbreviation is only meaningful within a certain location." Shouldn't PDT be -0700 parsed from anywhere and everywhere? If i parse PDT from Los_Angeles, or parse PDT from New_York, PDT should still mean -0700, is that not true? |
Wow. Did not know that timezone abbreviation is not standardized. Thanks! Is it because PDT is not known so it parses to "+0000 PDT"? This really threw me off for some time calculations. I'm also curious if it makes sense to have sane defaults, at least for non-duplicating definitions. But anyway, you guys are right, this is working as expected. Thank you for pointing this out to me. |
Yes. The docs for https://golang.org/pkg/time/#Parse say, in part:
I think that answers your question. But if you want to discuss further, you should use the mailing list rather than this issue. |
go version
)?go version go1.5.3 linux/amd64
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="linux"
Parsing RFC1123 the 4digit timezone exhibit different behavior depending on local timezone.
On my laptop set to PDT, the result is expected.
On a server set to UTC, the result is +0000 PDT (same behavior as https://play.golang.org/p/Tlbt2g24Fb)
2016-07-26 03:34:46 -0700 PDT
2016-07-26 03:34:46 +0000 PDT
The text was updated successfully, but these errors were encountered: