Skip to content

Instantly share code, notes, and snippets.

@julienetie
Created March 23, 2022 17:39
Show Gist options
  • Save julienetie/6af4f982b71cd89c9d18d70d6b490451 to your computer and use it in GitHub Desktop.
Save julienetie/6af4f982b71cd89c9d18d70d6b490451 to your computer and use it in GitHub Desktop.
Format ISO 8601 date Golang
package maiimport (
"fmt"
"time"
)
func main() {
layout := "2006-01-02T15:04:05Z"
t, err := time.Parse(layout, "2022-01-21T05:53:19Z")
if err != nil {
fmt.Println(err)
}
fmt.Println(t.Format("2006-01-02 15:04:05"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment