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?

asked May 23, 2017 by dtivl (2,500 points)

1 Answer

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

import("time")

func getEpochTime() int64 {
    return time.Now().Unix()
}
answered May 27, 2017 by dtivl (2,500 points)

Please log in or register to answer this question.

Related questions

1 answer
1 answer
1 answer
0 answers
1 answer
1 answer
Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...