# YAGTF Yet Another Golang Time Formatter ## English Documentation ### Tradition Mode 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 | Examples: `yyyy-MM-dd HH:mm:ss` -> `2000-02-15 19:27:35` `yy M3 dd E09 hh:mm:ss.S2 A` -> `96 Nov 14 Thursday 01:05:27.114514 PM` ### Advanced Mode Start your format string with `!`. If you want to use tradition mode, but your formatting string start with `!`, please start with `!!` to instead of `!`. (The `!` in middle of string will be auto-escaped) #### Pure Text Directly type pure text. For escaping `!`, use `` Examples: `hello, gensokyo` -> `hello, gensokyo!` #### Tag Use `<` and `>` to wrap the name of tag. For escaping `<` and '>', using `` and `` Examples: `--` -> `2019-01-02` `::` -> `<16:05:27>!` #### Non-display Tags Some of tags will not be displayed, they just be used for set some options. Examples: `:` -> `08:05` #### Display Tag List |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 |Alias | For Tag |:-: | :-: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Non-display Tag List |Tag | Function Description |:-: | :-: | | use UTC timezone for output | | use local timezone for output | | *use specified timezone for output | * Instuction For `` Tag: Specified timezone to use follow the colon. Using UTC offset format. Example: `` will specified the timezone to CST(+0800) for output. ### Using This Package In Go *Installation* ``` go get git.swzry.com/zry/YAGTF ``` *Coding* ``` ```