Muhammad Umer
Muhammad Umer

Reputation: 513

How can I parse this date in Golang?

I am having some trouble in parsing this date ("APR 19, 3:15p ET"), can anyone please help me in this regard?

This is the code which I have written.

d, err := time.Parse("JAN 02, 3:04p ET", date)

Thanks in advance.

Upvotes: 0

Views: 102

Answers (1)

JimB
JimB

Reputation: 109331

The 3 letter month constant is Jan

date := "APR 19, 3:15p ET"
d, err := time.Parse("Jan 02, 3:04p ET", date)

http://play.golang.org/p/LkeQOtc1Hd

Upvotes: 1

Related Questions