Skip to content

Instantly share code, notes, and snippets.

@drj11
Last active December 19, 2015 07:09
Show Gist options
  • Save drj11/5917057 to your computer and use it in GitHub Desktop.
Save drj11/5917057 to your computer and use it in GitHub Desktop.
Example of how to format dates in go.
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