[Go] Get the current Unix timestamp

Created on November 30, 2026

time.Now().Unix() returns the current Unix timestamp in seconds. time.Now() supplies the current time.Time, and Unix() converts it to seconds since January 1, 1970 at 00:00 UTC.

package main

import (
  "fmt"
  "time"
)

func main() {
  t := time.Now().Unix()
  fmt.Print(t)
}
Go