How to get the epoch timestamp in Go lang?

In Go lang, how to get the epoch timestamp, the number of seconds passed since the epoch?

In Go, you can use the time.Now() func to get current time and its Unix() func to convert it into an epoch timestamp:


func getEpochTime() int64 {
    return time.Now().Unix()
Answered by dtivl.

Leave a Reply

Your email address will not be published. Required fields are marked *