Yet Another Golang Time Formatter
zry c3c3986905 201909051405 | 4 lat temu | |
---|---|---|
.idea | 4 lat temu | |
tests | 4 lat temu | |
yagtf | 4 lat temu | |
.gitignore | 4 lat temu | |
LICENSE | 4 lat temu | |
README.md | 4 lat temu |
Yet Another Golang Time Formatter
Directly using the format string like 'yyyy-MM-dd HH:mm:ss'. It will be translated into advanced mode format string by simply string replacing.
Just for compatibility, not recommend for complex format.
Symbols:
Symbol | Function Description | Will Be Replaced To | Output Example |
---|---|---|---|
yyyy | long year | 2019 | |
yy | short year | 96 | |
MM | month with zero fill | 02 | |
M3 | month in English abbr. | Jan | |
M09 | month in English with zero fill | January | |
M9 | month in English without zero fill | January | |
M | month without zero fill | 2 | |
dd | day with zero fill | 05 | |
d | day without zero fill | 5 | |
HH | 24h hour with zero fill | 13 | |
hh | 12h hour with zero fill | 01 | |
H | 24h hour without zero fill | 13 | |
h | 12h hour without zero fill | 1 | |
mm | minute with zero fill | 01 | |
ss | second with zero fill | 05 | |
E09 | weekday in English with zero fill | Monday | |
E9 | weekday in English without zero fill | Monday | |
E3 | weekday in English abbr. | Mon | |
A | AM/PM | AM | |
S1 | millisecond | 026 | |
S2 | microsecond | 114514 | |
S3 | nanosecond | 019810019 | |
Z | timezone abbr. | CST | |
z | timezone UTC offset | +0800 |
Tag | Function Description | Output Example |
---|---|---|
long year | 2019 | |
short year | 96 | |
month with zero fill | 02 | |
month without zero fill | 2 | |
month in English abbr. | Jan | |
month in English with zero fill | January | |
month in English without zero fill | January | |
day with zero fill | 05 | |
day without zero fill | 5 | |
24h hour with zero fill | 13 | |
12h hour with zero fill | 01 | |
24h hour without zero fill | 13 | |
12h hour without zero fill | 1 | |
minute with zero fill | 01 | |
second with zero fill | 05 | |
weekday in numberic | 1 | |
weekday in English with zero fill | Monday | |
weekday in English without zero fill | Monday | |
weekday in English abbr. | Mon | |
AM/PM | AM | |
millisecond | 026 | |
microsecond | 114514 | |
nanosecond | 019810019 | |
the week in this year with zero fill | 06 | |
the week in this year without zero fill | 6 | |
the day in this year with zero fill | 034 | |
the day in this year without zero fill | 34 | |
timezone UTC offset | +0800 | |
timezone abbr. | CST | |
timezone offset in seconds with zero fill | 03600 | |
timezone offset in seconds without zero fill | 3600 | |
ISO8601 date | 2019-01-01 | |
ISO8601 time | 19:28:31 | |
ISO8601 full format | 2019-01-01T19:28:31+0800 | |
common format | 2019-01-01 19:28:31 | |
nginx default time format | 01/Jan/2019:19:28:31 +0800 | |
<!> | exclamation mark | ! |
less-than mark | < | |
great-than mark | > | |
quote mark | " | |
single quote mark | ' | |
space | ||
tab | ||
linebreak (valid in multi-line mode only) |
Alias | For Tag |
---|---|
Tag | Function Description |
---|---|
use UTC timezone for output | |
use local timezone for output | |
*use specified timezone for output |