szxczyc
V2EX  ›  问与答

2021-11-30T18:27:18.000+0800 这种格式的时间怎么转 unixtime

  •  
  •   szxczyc · Dec 2, 2021 · 1233 views
    This topic created in 1713 days ago, the information mentioned may be changed or developed.

    这个返回值是从 Jira 的 API 拿到的~

    用 Go 怎么都处理不了~

    想要转成 Unix time 存数据库的~

    created time : 2021-11-30T18:27:18.000+0800
    updated time : 2021-12-01T23:41:44.000+0800
    Jira issue status :Open
    
    
    func main() {
    	timeCST, _ := time.Parse("2006-01-02 15:04:05", "2021-11-30T18:27:18.000+0800")
    	fmt.Println(timeCST)  
    }
    
    3 replies    2021-12-02 09:11:36 +08:00
    xupefei
        1
    xupefei  
       Dec 2, 2021 via iPhone   ❤️ 1
    给你个关键词:ISO 8601 timestamp
    lalalaqwer
        2
    lalalaqwer  
       Dec 2, 2021   ❤️ 1
    time.Parse("2006-01-02T15:04:05.999-0700", "2021-12-01T23:41:44.000+0800")
    sujin190
        3
    sujin190  
       Dec 2, 2021
    你这代码百度复制粘贴的吧,第一个参数啥意思都不看下的么
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2967 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 14:39 · PVG 22:39 · LAX 07:39 · JFK 10:39
    ♥ Do have faith in what you're doing.