Never tried Go before and currently doing a small project. One of the task is to get current system time and represent it in YYYY-MM-DDT00:00:00Z
format. I believe that Z
means that time is represented in UTC format but when i looked into db, all timestamps are like this i.e., 2011-11-22T15:22:10Z
.
So how can i format like this in Go?
Update I was able to format it using following code
t := time.Now()
fmt.Println(t.Format("2006-01-02T15:04:05Z"))
Now the question remains, what Z
signifies here. Should i get UTC Time?
Another question, it looks like that the value i am using to format impacts the output i.e., when i used 2019-01-02T15:04:05Z
the output became 2029-02-02T20:45:11Z
, why?