如何将时间打印成这种格式?
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
时间包