date.go 249 B

1234567891011121314
  1. package main
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. func main() {
  7. now := time.Now()
  8. ts := now.Unix()
  9. loc, _ := time.LoadLocation("Asia/Shanghai")
  10. tm := time.Unix(ts, 0).In(loc)
  11. fmt.Printf("%s.%d", tm.Format("2006-01-02_15:04:05"), now.UnixMilli()%1000)
  12. }