Why is time.Parse
not using timezone information? It should return different time for different timezones.
Code
package main
import (
"fmt"
"time"
)
func main() {
t, err := time.Parse("2006-01-02 MST", "2018-05-11 IST")
if err != nil {
return
}
t2, err := time.Parse("2006-01-02 MST", "2018-05-11 UTC")
if err != nil {
return
}
fmt.Println(t.Unix())
fmt.Println(t2.Unix())
}
Output:
1525996800
1525996800
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…