Last active
December 19, 2015 07:09
-
-
Save drj11/5917057 to your computer and use it in GitHub Desktop.
Example of how to format dates in go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
t := time.Now() | |
fmt.Println(t.Format("2006-01-02 15:04:05 -0700")) // works | |
fmt.Println(t.Format("%Y-%m-%dT%H:%M:%S")) // does not work | |
fmt.Println(t.UTC().Format(time.RFC3339)) // best | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment