Search code examples
gotimeiso

Convert timestamp to ISO format in golang


I'm trying to convert the timestamp 2018-12-17T15:03:49.000+0000 to ISO format in golang, but am getting an error cannot parse "+0000" as "Z07:00"

This is what I tried

ts, err := time.Parse(time.RFC3339, currentTime)

Any ideas?


Solution

  • How about this?

    ts, err := time.Parse("2006-01-02T15:04:05.000+0000", currentTime)
    

    since time.RFC3339 is just 2006-01-02T15:04:05Z07:00