'In Parse() function, why the time.ANSIC layout didn't work in Go?
I am currently studying time library and I am not sure why the time.ANSIC at layout part didn't work what I expected.
In Parse() function there is a syntax func Parse (layout, value string) and based on my understanding I can use in layout part like time.UnixDate, ANSIC, RFC3339 etc.
When I code like below
const layout = "Jan 2, 2006 at 3:04pm (MST)"
sm, _ := time.Parse(layout, "Feb 4, 2014 at 6:05pm (PST)")
fmt.Println(sm)
It works as well and I got 2014-02-04 18:05:00 +0000 PST.
However, when I add time.ANSIC at layout part
tm, _ := time.Parse(time.ANSIC, "Feb 4, 2014 at 6:05pm (PST)")
fmt.Println(tm)
I got 0001-01-01 00:00:00 +0000 UTC.
I am not sure why do I get any time. I really appreciate your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
