Convertools Dev
All tools

Unix Timestamp in Go

Look up the current epoch time and convert between Unix seconds and UTC dates in Go.

Get the current timestamp

package main

import (
    "fmt"
    "time"
)

func main() {
    fmt.Println(time.Now().Unix())
}

Timestamp to date

package main

import (
    "fmt"
    "time"
)

func main() {
    fmt.Println(time.Unix(1_700_000_000, 0).UTC().Format(time.RFC3339))
}

Date to timestamp

package main

import (
    "fmt"
    "time"
)

func main() {
    date, err := time.Parse(time.RFC3339, "2023-11-14T22:13:20Z")
    if err != nil {
        panic(err)
    }
    fmt.Println(date.Unix())
}

Open 1700000000 in the converter

Current Unix time

Seconds—
Milliseconds—
UTC
—
My time zone
—

Official reference ↗

Free to use. Your input stays in this browser.

How to use it

  1. Copy the current-time example into your Go environment to read Unix seconds.
  2. Run the second example to display 1700000000 as a UTC date.
  3. Run the last example to convert that date back into seconds.

time.Unix takes seconds and a separate nanosecond argument. Call UTC() before formatting so the output is independent of the machine’s time zone.