2006-01-02 15:04:05yyyy-MM-dd HH:mm:ss
//sec 距离1970-01-01 00:00:00的秒值
//nsec 距离1970-01-01 00:00:00的纳秒值,精度更高
time.Unix(sec int64, nsec int64) 

//使用方法
seconds := 1590720566
unix := time.Unix(int64(seconds), 0)
fmt.Println(unix.Format("2006-01-02 15:04:05.999999999"))

>>>输出:

2020-05-29 10:49:26
// 日期转毫秒值
str := "2021-05-02 01:00:00"
parse, err := time.ParseInLocation("2006-01-02 15:04:05", str,time.Local)
fmt.Println(parse.Unix())
"2006-01-02 15:04:05.999999999"

在这里插入图片描述