Created
June 8, 2020 05:03
-
-
Save sanae10001/f360b207ea5fbf6b41ff95f06d771823 to your computer and use it in GitHub Desktop.
Function to convert a Unix Millisecond Epoch Timestamp to time.Time(https://github.com/Tigraine/go-timemilli)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package timemilli | |
import "time" | |
const millisInSecond = 1000 | |
const nsInSecond = 1000000 | |
// Converts Unix Epoch from milliseconds to time.Time | |
func FromUnixMilli(ms int64) time.Time { | |
return time.Unix(ms/int64(millisInSecond), (ms%int64(millisInSecond))*int64(nsInSecond)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment