其他分享
首页 > 其他分享> > golang 日期格式化参数介绍

golang 日期格式化参数介绍

作者:互联网

 

CarbonstrftimeGoMeaningExample
Y %Y 2006 Year, four digits 2020
y %y 06 Year, two digits 20
m %m 01 Month, two digits 08
n - 1 Month, as a number without leading zeros 8
M %b Jan Month name, abbreviated Aug
F %B January Month, full name August
d %d 02 Day of the month, two digits 21
j %e 2 Day of the month, without leading zero 21
w %w 0 Day of the week, as a number 5
D %a Mon Day of the week, abbreviated Fri
l %A Monday Day of the week, full name Friday
h %I 03 Hour, 12-hour notation 05
g %l 3 Hour, without leading zero 5
H %H 15 Hour, 24-hour notation 17
i %M 04 Minute, two digits 15
- - 4 Minute, without leading zero 15
s %S 05 Second, two digits 23
- - 5 Second, without leading zero 23
A %p PM AM or PM PM
a %P pm am or pm pm
v %L .000 Milliseconds 825
u %6 .000000 Microseconds (six digits) 825261
- %9 .000000000 Nanoseconds (nine digits) 825261389
O %z -0700 Timezone +0200
P - -07:00 Timezone +02:00
T %Z MST Timezone CEST

 

参考:https://chuniversiteit.nl/programming/datetime-formatting-in-go

标签:digits,格式化,zero,leading,two,golang,日期,without,Day
来源: https://www.cnblogs.com/jiemoon/p/14100893.html