Answers for "timestamp to time golang"

0

timestamp to time golang

package main

import (
    "fmt"
    "time"
)

func main() {
    tNow := time.Now()

    //time.Time to Unix Timestamp
    tUnix := tNow.Unix()
    fmt.Printf("timeUnix %d\n", tUnix)

    //Unix Timestamp to time.Time
    timeT := time.Unix(tUnix, 0)
    fmt.Printf("time.Time: %s\n", timeT)
}
Posted by: Guest on June-12-2021
0

timestamp to time golang

timeUnix 1257894000
time.Time: 2009-11-10 23:00:00 +0000 UTC
Posted by: Guest on June-12-2021

Browse Popular Code Answers by Language