import "time"
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
2009-11-10 23:00:00 +0000 UTC m=+0.000000000
1257894000
1257894000000000000
时间格式化
now := time.Now().Format("2006-01-02 15:04:05")
指定时区时间格式化
local,_ := time.LoadLocation("Asia/Shanghai")
now := time.Now().In(local).Format("2006-01-02 15:04:05")
sleep
time.Sleep(time.Duration(60) * time.Second)