Skip to content

Commit

Permalink
Add FromStdTime and ToStdTime methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Jan 7, 2023
1 parent 438a5a2 commit 83dc90a
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1471,43 +1471,43 @@ invalid timezone "xxx", please see the file "$GOROOT/lib/time/zoneinfo.zip" for

##### <a id="format-sign-table">Format sign table</a>

| sign | desc | length | range | example |
| :------------: |:--------------------------------------------------------------------------------------------------------:|:------:|:----------------:|:-------------------------------:|
| d | Day of the month, padded to 2 | 2 | 01-31 | 02 |
| D | Day of the week, as an abbreviate localized string | 3 | Mon-Sun | Mon |
| j | Day of the month, no padding | - | 1-31 | 2 |
| S | English ordinal suffix for the day of the month, 2 characters. Eg: st, nd, rd or th. Works well with j | 2 | st/nd/rd/th | th |
| l | Day of the week, as an unabbreviated localized string | - | Monday-Sunday | Monday |
| F | Month as an unabbreviated localized string | - | January-December | January |
| m | Month, padded to 2 | 2 | 01-12 | 01 |
| M | Month as an abbreviated localized string | 3 | Jan-Dec | Jan |
| n | Month, no padding | - | 1-12 | 1 |
| Y | Four-digit year | 4 | 0000-9999 | 2006 |
| y | Two-digit year | 2 | 00-99 | 06 |
| a | Lowercase morning or afternoon sign | 2 | am/pm | pm |
| A | Uppercase morning or afternoon sign | 2 | AM/PM | PM |
| g | Hour in 12-hour format, no padding | - | 1-12 | 3 |
| G | Hour in 24-hour format, no padding | - | 0-23 | 15 |
| h | Hour in 12-hour format, padded to 2 | 2 | 00-11 | 03 |
| H | Hour in 24-hour format, padded to 2 | 2 | 00-23 | 15 |
| i | Minute, padded to 2 | 2 | 01-59 | 04 |
| s | Second, padded to 2 | 2 | 01-59 | 05 |
| c | ISO8601 date | - | - | 2006-01-02T15:04:05-07:00 |
| r | RFC2822 date | - | - | Mon, 02 Jan 2006 15:04:05 -0700 |
| O | Difference to Greenwich time (GMT) without colon between hours and minutes | - | - | +0700 |
| P | Difference to Greenwich time (GMT) with colon between hours and minutes | - | - | +07:00 |
| T | Abbreviated timezone | - | - | MST |
| W | ISO8601 week of the year | 2 | 01-52 | 01 |
| N | ISO8601 day of the week | 2 | 01-07 | 02 |
| L | Whether it's a leap year | 1 | 0-1 | 0 |
| U | Unix timestamp with seconds | 10 | - | 1611818268 |
| u | Millisecond | - | 1-999 | 999 |
| w | Day of the week | 1 | 0-6 | 1 |
| t | Total days of the month | 2 | 28-31 | 31 |
| z | Day of the year | - | 1-365 | 2 |
| e | Location | - | - | America/New_York |
| Q | Quarter | 1 | 1-4 | 1 |
| C | Century | - | 0-99 | 21 |
| sign | desc | length | range | example |
| :------------: |:------------------------------------------------------------------------------------------------------------------:|:------:|:----------------:|:-------------------------------:|
| d | Day of the month, padded to 2 | 2 | 01-31 | 02 |
| D | Day of the week, as an abbreviate localized string | 3 | Mon-Sun | Mon |
| j | Day of the month, no padding | - | 1-31 | 2 |
| S | English ordinal suffix for the day of the month, 2 characters. Eg: st, nd, rd or th. Works well with j | 2 | st/nd/rd/th | th |
| l | Day of the week, as an unabbreviated localized string | - | Monday-Sunday | Monday |
| F | Month as an unabbreviated localized string | - | January-December | January |
| m | Month, padded to 2 | 2 | 01-12 | 01 |
| M | Month as an abbreviated localized string | 3 | Jan-Dec | Jan |
| n | Month, no padding | - | 1-12 | 1 |
| Y | Four-digit year | 4 | 0000-9999 | 2006 |
| y | Two-digit year | 2 | 00-99 | 06 |
| a | Lowercase morning or afternoon sign | 2 | am/pm | pm |
| A | Uppercase morning or afternoon sign | 2 | AM/PM | PM |
| g | Hour in 12-hour format, no padding | - | 1-12 | 3 |
| G | Hour in 24-hour format, no padding | - | 0-23 | 15 |
| h | Hour in 12-hour format, padded to 2 | 2 | 00-11 | 03 |
| H | Hour in 24-hour format, padded to 2 | 2 | 00-23 | 15 |
| i | Minute, padded to 2 | 2 | 01-59 | 04 |
| s | Second, padded to 2 | 2 | 01-59 | 05 |
| c | ISO8601 date | - | - | 2006-01-02T15:04:05-07:00 |
| r | RFC2822 date | - | - | Mon, 02 Jan 2006 15:04:05 -0700 |
| O | Difference to Greenwich time (GMT) without colon between hours and minutes | - | - | +0700 |
| P | Difference to Greenwich time (GMT) with colon between hours and minutes | - | - | +07:00 |
| T | Abbreviated timezone | - | - | MST |
| W | week of the year, padded to 2 | 2 | 01-52 | 01 |
| N | day of the week, padded to 2 | 2 | 01-07 | 02 |
| L | Whether it's a leap year | 1 | 0-1 | 0 |
| U | Unix timestamp with seconds | 10 | - | 1611818268 |
| u | Millisecond | - | 1-999 | 999 |
| w | Day of the week | 1 | 0-6 | 1 |
| t | Total days of the month | 2 | 28-31 | 31 |
| z | Day of the year | - | 1-365 | 2 |
| e | Location | - | - | America/New_York |
| Q | Quarter | 1 | 1-4 | 1 |
| C | Century | - | 0-99 | 21 |

#### FAQ

Expand Down

0 comments on commit 83dc90a

Please sign in to comment.