Initial try to parse UNIX time with timezone info

main
Jasper Bok 2023-08-13 15:41:54 +02:00
parent aa958b77b1
commit c2bbb9e560
1 changed files with 11 additions and 1 deletions

View File

@ -9,10 +9,20 @@ import (
func parseUnixTimestamp(timestamp string) (time.Time, error) {
var t = time.Time{}
loc, err := time.LoadLocation("Europe/Amsterdam")
if err != nil {
return t, err
}
i, err := strconv.ParseInt(timestamp, 10, 64)
if err != nil {
return t, err
}
return time.Unix(i, 0), nil
t, err = time.Unix(i, 0), nil
if err != nil {
return t, err
}
return t.In(loc), nil
}