News for hackers. Stuff that matters.
Re:Time in Go by paradite on Thursday September 10, 2015 @01:23AM (#10196252)
http://play.golang.org/p/hCoZ3tdeM_ am I doing this correctly?

Because it seems that golang does not recognize the abbreviations at all.

Re:Time in Go by nulltype on Thursday September 10, 2015 @02:29AM (#10196388)
If you use time zones without offsets (just the name like PST instead of -0700) then you have to parse the time in a specific location http://play.golang.org/p/JzKAq09NtE

I can only assume that the time zone name alone is insufficient to resolve ambiguous times.

Re:Time in Go by paradite on Thursday September 10, 2015 @02:41AM (#10196419)
Then I think it is not very convenient to type out strings like "America/Los_Angeles" when you are dealing with timezones that come with abbreviations only. The whole point of using abbreviations is to avoid typing out the full name.

Unless there is a way to get "America/Los_Angeles" from "PST"

Re:Time in Go by bitwalker on Thursday September 10, 2015 @02:50PM (#10199838)
I mentioned this elsewhere in this thread, but abbreviations are not unique across timezones. The rules for timezones change based on locale, and if you have multiple zones with PST as an abbreviation, which one do you use? It has to be an explicit choice or it's almost certainly going to be wrong. There is no way to get America/Los_Angeles from PST without knowing the locale that the date and time is from.
Re:Time in Go by nulltype on Thursday September 10, 2015 @02:54AM (#10196459)
Yeah, I don't get why they require a location.

On the other hand, -0700 isn't much longer than PST and parses directly.

Re:Time in Go by bitwalker on Thursday September 10, 2015 @02:45PM (#10199812)
Abbreviations are reused in different locales. PST in one locale can have different rules than PST in another locale. The reason the fully qualified name is needed is because it uniquely identifies a locale for which timezone rules can be followed.

Offsets aren't always the right thing to use either. If you are in America/Chicago and use -0600 for your timezone, that's only accurate during standard time, and is off by an hour for daylight savings time. Knowing how/when to shift offsets is part of the timezone rules associated with a locale, because they are not constant historically.

Re:Time in Go by nulltype on Friday September 11, 2015 @02:20AM (#10202263)
Ah thanks, that confirms my theory of why the location is required to parse time zone names like PST.

Offsets are probably going to be fine for recorded timestamps, if all you need is the absolute time that the timestamp represents. But yeah, timezones make things so complicated that there is no one true solution I guess.