douken7402 2019-09-20 15:55
浏览 485

如何解析“ 2019-09-19 04:03:01.770080087 +0000 UTC”时间戳[重复]

This question already has an answer here:

How would I parse this timestamp?

"2019-09-19 04:03:01.770080087 +0000 UTC"

I've tried the following:

formatExample := obj.CreatedOn // obj.CreatedOn = "2019-09-19 04:03:01.770080087 +0000 UTC"
time, err := time.Parse(formatExample, obj.CreatedOn)
check(err)
fmt.Println(time)

But all I get as output is:

0001-01-01 00:00:00 +0000 UTC

</div>
  • 写回答

3条回答 默认 最新

  • douyanzan9145 2019-09-20 16:04
    关注

    Parse parses a formatted string and returns the time value it represents. The layout defines the format by showing how the reference time, defined to be

    Mon Jan 2 15:04:05 -0700 MST 2006

    would be interpreted if it were the value; it serves as an example of the input format. The same interpretation will then be made to the input string.

    formatExample := "2006-01-02 15:04:05.999999999 -0700 MST"
    

    https://play.golang.org/p/APkXHUAhMQ3

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器