Code snippets / Go
How to get the current Unix timestamp in Go
Go uses `time.Now()` for an instant and `time.Unix(sec, nsec)` to build one from epoch parts. Unlike many languages, Go encourages nanoseconds via `UnixNano()`.
Format with `time.RFC3339` (ISO 8601) or any custom layout from the reference time "Mon Jan 2 15:04:05 MST 2006".
Current Unix timestamp (seconds)
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now().Unix()
fmt.Println(now) // 1,754,136,000
} Convert epoch seconds → ISO 8601 (UTC)
t := time.Unix(1754136000, 0).UTC()
fmt.Println(t.Format(time.RFC3339)) // 2025-08-02T12:00:00Z Example values used above: epoch seconds = 1,754,136,000 · ISO 8601 = 2025-08-02T12:00:00.000Z
Need more languages? Browse all the Unix timestamp code snippets. Curious how the numbers work? See the Unix epoch time FAQ, or view the current epoch time in any timezone.
Epoch → Human Date
Try it live — convert any timestamp in Go-friendly format.
Seconds or milliseconds — the unit is auto-detected. Example: 1735689600
UTC ISO 8601
–
Local — auto
–
RFC 2822 / GMT
–
Seconds value
–
Relative time
–