Answers for "golang get current time"

Go
1

time now golang int64

now := time.Now()      // current local time
sec := now.Unix()      // number of seconds since January 1, 1970 UTC
nsec := now.UnixNano() // number of nanoseconds since January 1, 1970 UTC

fmt.Println(now)  // time.Time
fmt.Println(sec)  // int64
fmt.Println(nsec) // int64
Posted by: Guest on January-23-2021
2

go packae unix time

package main

import (
	"fmt"
	"time"
)

func unixtime() {
	fmt.Println(time.Now().Unix())
}
Posted by: Guest on July-05-2020

Browse Popular Code Answers by Language