You can parse string value use time.Parse(layout, value string) and then parsed.Format(layout string) the result (look at src/time/format.go, src/time/format_test.go)

date := "2020-11-03T06:30:00.000Z"
parsed, err := time.Parse(time.RFC3339, date)
fmt.Println(parsed)
fmt.Println(parsed.Format("15:04 PM"))

0utput 👇🏼

2020-11-03 06:30:00 +0000 UTC
06:30 AM

PLAYGROUND

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top