time: clarify docs about standard time #4364
What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Try to make sense of the time.Format (for time.Parse) documentation. 2. 3. What is the expected output? Documentation states that the time formats are for a specific time. That is: Mon Jan 2 15:04:05 MST 2006 which is Unix time 1136243045 However, this disagrees with the GNU date tool: $ date --date="Mon Jan 2 15:04:05 MST 2006" +%s 1136239445 A difference of an hour (1136239445 - 1136243045 = -3600). I was trying to use a "UTC" format "YYYY-MM-DD HH:mm:dd", and thought (based on this documentation) that I should supply the date string for the canonical time (in UTC). It wasn't clear based on this discrepancy whether that time was: "2006-01-02 22:04:05" (1136239445) or "2006-01-02 23:04:05" (1136243045) It turns out, the format I need is: "2006-01-02 15:04:05" which seems to pretty much ignore the canonical time... I feel the documentation could be more clear here. Thanks. Which compiler are you using (5g, 6g, 8g, gccgo)? Documentation from the golang website. Which operating system are you using? Linux Which version are you using? (run 'go version') Please provide any additional information below.
I think there are two separate issues here, both documentation nits. 1. The standard Unix seconds time given might be wrong (not 15:04:05 MST). I thought maybe the output of gnu date might be because you were using a machine in California, but I tried it on a machine in New York and got the same number you did - 1136239445 - and not the one in our docs. It is possible that gnu date is wrong but equally possible we changed the standard time from PST to MST without updating the Unix seconds. 2. The docs could be clearer that even if you're formatting a UTC time you still use 15:04:05 and not whatever that is in UTC.
Labels changed: added priority-later, removed priority-triage.
Owner changed to @robpike.
Status changed to Accepted.