Skip to content

Instantly share code, notes, and snippets.

@hnakamur
Created July 22, 2013 14:52
Show Gist options
  • Save hnakamur/6054434 to your computer and use it in GitHub Desktop.
Save hnakamur/6054434 to your computer and use it in GitHub Desktop.
parse ISO8601 datetime in go http://play.golang.org/p/xe2mWIHZGU
package main
import (
"fmt"
"time"
)
func main() {
t, err := time.Parse(time.RFC3339Nano, "2013-06-05T14:10:43.678Z")
if err != nil {
panic(err)
}
fmt.Println(t)
}
@hnakamur
Copy link
Author

@sbowman
Copy link

sbowman commented Aug 16, 2016

This is a valid ISO 8601 timestamp: "2016-08-06T17:20:33.803-0400".

Your code wont' parse it.

@heretic13
Copy link

2017-01-31T09:12:52
Valid ISO 8601 timestamp
Your code wont' parse it.
Nothing interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment