Input to long tor unix time


I playing with a rest api, using golang http.Client. One of the responses I get is a timestamp in UNIX time.
The input is 13 numbers long, I cant convert it to time using time.Unix, It only takes 10 digits.

I have solved it this way:

  1. Convert the input to a string.
    2 Only take 10 chars.
  2. Convert it back to ints.
  3. Convert to unix time.

Any better ideas to solve this?


I think I came up with a simpler solutino:

Divede the input with 1000, cast it to a int64, then convert from Unix time to time.Time

// Micke

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.