I'm trying to generate ISO 8601 timestamp in Golang.
Doing
time.Now().UTC().Format(time.RFC3339)
//2016-04-12T19:32:20Z
in Javascript
new Date().toISOString()
//2016-04-12T19:46:47.286Z
It appears the only difference is in JavaScript the time reports milliseconds, while Golang it produces it in seconds. I'd like to try and get these to be the same.
I've looked at time.RFC3339Nano
But that produces too much precision 2016-04-12T19:35:16.341032697Z
How can I get Golang to produce time that is equivalent to JavaScript's toISOString()
?