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?
to your account
Please answer these questions before submitting your issue. Thanks!
1.7.3 (but tried tip as well)
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/02/k62z5c796fs5gm651jc610v80000gn/T/go-build475244754=/tmp/go-build -gno-record-gcc-switches -fno-common"
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
When using json.Marshal on a time value, I expected the a myTime.Location() to always be Local when the host timezone is set.
If my local time is set to GMT, I see UTC instead of Local.
using time.Parse() as shown in the example seems to work correctly, but when the value is marshaled to/from JSON the output is inconsistent between timezone.
The text was updated successfully, but these errors were encountered:
add mysql and redis services (#471)
enable redis and mysql tests in CircleCI environment
switch redis test to use UTC time - golang/go#17885
I tried time.Parse with RFC3339 time format, which makes the above clearer:
// Output in EST: 2016-11-12T11:12:37-05:00
// Output in PST: 2016-11-12T08:19:15-08:00
// Output in GMT: 2016-11-12T16:19:40Z
using time.Parse with 2016-11-12T16:19:40-00:00 prints Local correctly when in GMT.
Sorry, something went wrong.
This is a dupe of #17875; Local and UTC are the same if your timezone is GMT, so encoding/json is working as intended. We make no guarantees about which location object is attached to times, only that a time that is t.Equal is returned.
No branches or pull requests