Reputation: 337
I has a special time string like this: February 24, 2017 , 1:44 pm
and want to translate it to a golang time.Time object, does anyone know how to do this work. I have tried to using time.Parse()
, but always got errors.
Thanks.
Upvotes: 1
Views: 1201
Reputation: 407
Read https://golang.org/pkg/time/#pkg-constants to know how to define your own formats or use predefined formates.
Upvotes: 0
Reputation: 180
Use the format string January 2, 2006 , 3:04 pm
to parse that kind of string.
Example: https://play.golang.org/p/4HgRekLr-7
Upvotes: 2