我在代码中看到了时间格式"0102150405“,但我不知道格式是什么,有人对此有什么想法吗?
time.Now().UTC().Format("0102150405")
发布于 2022-09-02 11:07:34
(January 2, 15:04:05, 2006, in time zone seven hours west of GMT).
That value is recorded as the constant named Layout, listed below.
As a Unix time, this is 1136239445. Since MST is GMT-0700,
the reference would be printed by the Unix date command as:
Mon Jan 2 15:04:05 MST 2006
您可以使用它来格式化您得到的time
值。
0102150405
的意思是希望将time.Now()
格式化为string
,类似于"${month}${day}${hour}${minute}${second}"
。
这里是布局字符串组件的摘要。每个元素通过示例显示引用时间的元素的格式设置。只有这些值被识别。布局字符串中未被识别为引用时间一部分的文本在格式期间逐字回显,并期望在Parse的输入中逐字显示。
年份:"2006“"06”
月份:“一月”一月"01“"1”
周中的一天:“星期一”
月份日:"2“"_2”"02“
年度之日:"__2“"002”
小时:"15“"3”"03“(下午或上午)
会议纪要:"4“"04”
第二:"5“"05”
AM/PM标记:"PM“
见更多:
https://stackoverflow.com/questions/73581472
复制相似问题