I want to convert UTC time (a string) in the following format
2018-05-11T01:32:29.477-06:00
to
time.Time
ortimestamp.Timestamp
objects in Go.
Here are links to the libraries:
Time - https://golang.org/pkg/time/
Timestamp -https://github.com/golang/protobuf/blob/master/ptypes/timestamp.go
I've tried formatting the string to unix time and later on converting to time.Time
with no luck.
Here's some code snippet to further explain this:
stringUTC := "2018-05-11T01:32:29.477-06:00"
i, err := strconv.ParseInt(stringUTC, 10, 64)
if err != nil {
panic(err) // results in error and panics
}
tm := time.Unix(i, 0)