Parsing RFC-3339 / ISO-8601 date-time string in Go

I tried parsing the date string "2014-09-12T11:45:26.371Z" in Go. This time format is defined as:

  • RFC-3339 date-time
  • ISO-8601 date-time

Code

layout := "2014-09-12T11:45:26.371Z"
str := "2014-11-12T11:45:26.371Z"
t, err := time.Parse(layout , str)

I got this error:

parsing time “2014-11-12T11:47:39.489Z”: month out of range

How can I parse this date string?

8 Answers
8

Leave a Comment