Standard library / time

time.Time.Unix()

Return whole seconds since the Unix epoch independent of display location. Expected stdout: '1\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) Unix() int64

Return Value

int64

Return whole seconds since the Unix epoch independent of display location.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func main() { fmt.Println(time.Unix(1, 500000000).Unix()) }
Go Reference