如何将时间打印为此格式23:44:22.184320

  • 本文关键字:184320 格式 时间 打印 go
  • 更新时间 :
  • 英文 :


如何将时间打印成这种格式?

23:44:22.184320

我试过的是

func main() {
// Which will print to the current time
fmt.Println(time.Now())
// How do I convert to
// 23:44:22.184320
}

我已经检查了这个链接,但我不知道该怎么做https://gobyexample.com/time-formatting-parsing

谢谢!

改为使用这个:

time.Now().Format("15:04:05.999999")

请注意,time包的时间布局为:

Mon Jan 2 15:04:05 MST 2006

时间包

最新更新