package main import ( "fmt" "time" ) func main() { now := time.Now() ts := now.Unix() loc, _ := time.LoadLocation("Asia/Shanghai") tm := time.Unix(ts, 0).In(loc) fmt.Printf("%s.%d", tm.Format("2006-01-02_15:04:05"), now.UnixMilli()%1000) }