golang get current datetime iso 8061 code example
Example: Golang convert from ISO 8601 to milliseconds
func main() {
// convert iso-8601 into rfc-3339 format
rfc3339t := strings.Replace("2015-12-23 00:00:00", " ", "T", 1) + "Z"
// parse rfc-3339 datetime
t, err := time.Parse(time.RFC3339, rfc3339t)
if err != nil {
panic(err)
}
// convert into unix time
ut := t.UnixNano() / int64(time.Millisecond)
fmt.Println(ut)
}