Created
March 23, 2022 17:39
-
-
Save julienetie/6af4f982b71cd89c9d18d70d6b490451 to your computer and use it in GitHub Desktop.
Format ISO 8601 date Golang
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 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