Hi,

time.Parse is failing to parse a date generated with time.Format using 
time.UnixDate as layout here (if I use the similar).

I have not ditched so much in the code, but it appears it is considering 
the timezone to be "" and trying to use the -03 value as offset (see 
example below). And I am also not sure if this is an issue with golang, my 
system, or just working as intended due to layout limitations.

$ date
Wed Apr 12 14:47:09 -03 2017
# if I change my timezone to, say, PST, it would show something like "Wed 
Apr 12 10:47:09 PST 2017"

$ go run time.go
current: Wed Apr 12 14:49:20 -03 2017
parsed: 0001-01-01 00:00:00 +0000 UTC, err = parsing time "Wed Apr 12 
14:49:20 -03 2017" as "Mon Jan _2 15:04:05 MST 2006": cannot parse "-03 
2017" as "MST"

$ cat time.go
package main

import (
"fmt"
"time"
)

func main() {
var t = time.Now().Format(time.UnixDate)
fmt.Printf("current: %v\n", t)
var parsed, err = time.Parse(time.UnixDate, t)

fmt.Printf("parsed: %v, err = %v\n", parsed, err)
}


Since my last operating system update (macOS 10.12.4 (16E195)) my system 
timestamp is returning as '-03' as you can see in
https://gist.github.com/henvic/88b205389994bafb32b10961d1ddad2a

You can see this video I made showing what happens in practice:
https://cl.ly/0o3V1b0o3p0P/timezone-issue.gif

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to