Go newcomer here.
I have a date string 2018-06-07T16:16:57Z
and I want to convert it to something like this mm/dd/yyyy hh:mm
.
This seems to be a frequently asked question, but I can't seem to find any previous questions that work for me.
I'm reading in a time field and trying to convert like this
time := row["Date & Time"]
fmt.Println(time)
t, _ := time.Parse("2006-01-02 15:04:05 -0700 UTC", time)
fmt.Println(t)
But I think the issue is that I don't have a correct format string. I've tried a few resources to no success.
When I print t
as is, I get 0001-01-01 00:00:00 +0000 UTC
as a result, which is obviously incorrect.
What I'd like to do is convert the time I'm reading in like this
newTime := currentDate.Format("01/02/2006 hh:mm")