如何在Golang中解析这个日期?

huangapple go评论79阅读模式
英文:

How can I parse this date in Golang?

问题

我在解析这个日期("APR 19, 3:15p ET")时遇到了一些问题,有人可以帮我吗?

这是我写的代码。

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

提前感谢。

英文:

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.

答案1

得分: 1

3个字母的月份常量是Jan

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

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

英文:

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

huangapple
  • 本文由 发表于 2016年4月20日 04:47:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/36729147.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定