Author: Paolo Lulli <paolo@lulli.net>
Parse timestamp in event listing
client/main.go | 6 +++++-
diff --git a/client/main.go b/client/main.go index 52db9f528b40d37f664adea4d8b525ba1a9d02f3..76d35835d75502795614440eb9c2554058bc91ad 100644 --- a/client/main.go +++ b/client/main.go @@ -146,7 +146,11 @@ err := json.Unmarshal(dataJson, &eventListModel) if err == nil { for _, event := range eventListModel { - fmt.Printf("%d %s\n", event.Etime, event.Name) + unixTimeUTC := time.Unix(event.Etime/1000, 0) //gives unix time stamp in utc + + unitTimeInRFC3339 := unixTimeUTC.Format(time.RFC3339) // converts utc time to RFC3339 format + + fmt.Printf("%s %s\n", unitTimeInRFC3339, event.Name) } } else { fmt.Println(err)