golang格式化时间时,比如如下格式进行格式化输出:

fmt.Println(time.Now().Format("2007年03月"))

程序直接输出:

16007年02月

很奇葩,但是若改成:

fmt.Println(time.Now().Format("2006年01月"))

程序正确输出:

2016年06月

据说是go诞生日期,只认这个,更详细的时间是:

fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
2016-06-16 14:18:17

 

相关文章:

  • 2021-08-27
  • 2021-05-04
  • 2021-08-20
  • 2021-10-04
  • 2021-11-22
  • 2021-11-05
  • 2021-11-19
  • 2021-05-23
猜你喜欢
  • 2021-11-30
  • 2021-08-17
  • 2021-06-25
  • 2022-12-23
  • 2021-07-07
  • 2021-07-24
  • 2018-08-21
相关资源
相似解决方案