donglie1994 2019-06-21 11:48
浏览 294

golang中的时间格式-DayOfyearTHour:Minute.000Z

I want to convert the timestamp to DayOfyearTHour:Minute.000Z in golang. As i am new to golang, can someone help me please

 package main

 import (   "fmt"   "time" )

 func main() {  
        layout := "2006-01-02T15:04:05.000Z"    
        str :="2019-05-10 19:02:27.917 +0000 UTC"   
        t, err := time.Parse(layout, str)

    if err != nil {
            fmt.Println(err)    }   fmt.Println(t)

 }

The below is the error

parsing time "2019-05-10 19:02:27.917 +0000 UTC" as "2006-01-02T15:04:05.000Z": cannot parse " 19:02:27.917 +0000 UTC" as "T"
0001-01-01 00:00:00 +0000 UTC
  • 写回答

1条回答 默认 最新

  • douhensheng1131 2019-07-14 22:21
    关注

    You can see the implementation in this package. If you don't have the chance to upgrade Go version (1.13 is not out yet) you can do it by yourselve!

    BTW: I'm making a series of videos about Golang development. If you like, you guys can add the topics you'd like to get covered by completing this form.

    评论

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程