为什么javascript的时间戳与Go的时间戳不同?
const date = new Date(new Date("2019-12-27T15:04:03").toUTCString());
date.getTime() //1577455443000
datetime := "2019-12-27T15:04:03Z"
t, _ := time.Parse(time.RFC3339, datetime)
fmt.Println(t.UTC().UnixNano() / 1000000) // 1577459043000
防止这种分歧的正确方法是什么?
Java时间是将本地时间15:04:03转换为UTC。
开始时间是世界标准时间15:04:03。
毫秒的数目,如此处所述:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
UnixNano()in go返回自Unix纪元以来经过的nanoseconds
数,如此处所述:https://godoc.org/time#Time.UnixNano