Extract strftime to /strftime
This commit is contained in:
parent
0c9f223716
commit
f0c9c7d1c1
|
@ -0,0 +1,60 @@
|
|||
## {{ include.title }}
|
||||
{: .-three-column}
|
||||
|
||||
### Presets
|
||||
|
||||
#### Date
|
||||
|
||||
| Example | Output |
|
||||
| --- | --- |
|
||||
| `%m/%d/%Y` | `06/05/2013` |
|
||||
| `%A, %B %e, %Y` | `Sunday, June 5, 2013` |
|
||||
| `%b %e %a` | `Jun 5 Sun` |
|
||||
{: .-shortcuts}
|
||||
|
||||
#### Time
|
||||
|
||||
| Example | Output |
|
||||
| --- | --- |
|
||||
| `%H:%M` | `23:05` |
|
||||
| `%I:%M %p` | `11:05 PM` |
|
||||
{: .-shortcuts}
|
||||
|
||||
Used by Ruby, UNIX `date`, and many more.
|
||||
|
||||
### Date
|
||||
|
||||
| Symbol | Example | Area |
|
||||
| --- | --- | --- |
|
||||
| `%a` | `Sun` | **Weekday** |
|
||||
| `%A` | `Sunday` | |
|
||||
| `%w` | `0`..`6` _(Sunday is 0)_ | |
|
||||
| --- | --- | --- |
|
||||
| `%y` | `13` | **Year** |
|
||||
| `%Y` | `2013` | |
|
||||
| --- | --- | --- |
|
||||
| `%b` | `Jan` | **Month** |
|
||||
| `%B` | `January` | |
|
||||
| `%m` | `01`..`12` | |
|
||||
| --- | --- | --- |
|
||||
| `%d` | `01`..`31` | **Day** |
|
||||
| `%e` | `1`..`31` | |
|
||||
{: .-shortcuts}
|
||||
|
||||
### Time
|
||||
|
||||
| Symbol | Example | Area |
|
||||
| --- | --- | --- |
|
||||
| `%l` | `1` | Hour |
|
||||
| `%H` | `00`..`23` | 24h Hour |
|
||||
| `%I` | `01`..`12` | 12h Hour |
|
||||
| -- | --- | --- |
|
||||
| `%M` | `00`..`59` | Minute |
|
||||
| `%S` | `00`..`60` | Second |
|
||||
| --- | --- | --- |
|
||||
| `%p` | `AM` | AM or PM |
|
||||
| `%Z` | `+08` | Time zone |
|
||||
| --- | --- | --- |
|
||||
| `%j` | `001`..`366` | Day of the year |
|
||||
| `%%` | `%` | Literal % character |
|
||||
{: .-shortcuts}
|
69
datetime.md
69
datetime.md
|
@ -6,71 +6,12 @@ updated: 2017-09-04
|
|||
tags: [Featurable]
|
||||
---
|
||||
|
||||
### Common time formats
|
||||
## Common time formats
|
||||
{: .-one-column}
|
||||
|
||||
- [UNIX](#unix) - Used by Ruby, `date`, and more
|
||||
- [Moment.js](#moment-js) - Used by Moment.js, date-fns, and more
|
||||
- [UNIX strftime](./strftime) - Used by Ruby, `date`, and more
|
||||
- [Moment.js](./moment#formatting) - Used by Moment.js, date-fns, and more
|
||||
|
||||
## UNIX
|
||||
{: .-three-column}
|
||||
{% include common/strftime_format.md title="strftime format" %}
|
||||
|
||||
### Presets
|
||||
|
||||
#### Date
|
||||
|
||||
| Example | Output |
|
||||
| --- | --- |
|
||||
| `%m/%d/%Y` | `06/05/2013` |
|
||||
| `%A, %B %e, %Y` | `Sunday, June 5, 2013` |
|
||||
| `%b %e %a` | `Jun 5 Sun` |
|
||||
{: .-shortcuts}
|
||||
|
||||
#### Time
|
||||
|
||||
| Example | Output |
|
||||
| --- | --- |
|
||||
| `%H:%M` | `23:05` |
|
||||
| `%I:%M %p` | `11:05 PM` |
|
||||
{: .-shortcuts}
|
||||
|
||||
Used by Ruby, UNIX `date`, and many more.
|
||||
|
||||
### Date
|
||||
|
||||
| Symbol | Example | Area |
|
||||
| --- | --- | --- |
|
||||
| `%a` | `Sun` | **Weekday** |
|
||||
| `%A` | `Sunday` | |
|
||||
| `%w` | `0`..`6` _(Sunday is 0)_ | |
|
||||
| --- | --- | --- |
|
||||
| `%y` | `13` | **Year** |
|
||||
| `%Y` | `2013` | |
|
||||
| --- | --- | --- |
|
||||
| `%b` | `Jan` | **Month** |
|
||||
| `%B` | `January` | |
|
||||
| `%m` | `01`..`12` | |
|
||||
| --- | --- | --- |
|
||||
| `%d` | `01`..`31` | **Day** |
|
||||
| `%e` | `1`..`31` | |
|
||||
{: .-shortcuts}
|
||||
|
||||
### Time
|
||||
|
||||
| Symbol | Example | Area |
|
||||
| --- | --- | --- |
|
||||
| `%l` | `1` | Hour |
|
||||
| `%H` | `00`..`23` | 24h Hour |
|
||||
| `%I` | `01`..`12` | 12h Hour |
|
||||
| -- | --- | --- |
|
||||
| `%M` | `00`..`59` | Minute |
|
||||
| `%S` | `00`..`60` | Second |
|
||||
| --- | --- | --- |
|
||||
| `%p` | `AM` | AM or PM |
|
||||
| `%Z` | `+08` | Time zone |
|
||||
| --- | --- | --- |
|
||||
| `%j` | `001`..`366` | Day of the year |
|
||||
| `%%` | `%` | Literal % character |
|
||||
{: .-shortcuts}
|
||||
|
||||
{% include common/moment_format.md title="Moment.js" %}
|
||||
{% include common/moment_format.md title="Moment.js format" %}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
title: strftime format
|
||||
layout: 2017/sheet
|
||||
weight: -5
|
||||
updated: 2017-09-04
|
||||
tags: [Featurable]
|
||||
intro: |
|
||||
The strftime format is the standard date formatting for UNIX. It's used in C, Ruby, and more.
|
||||
---
|
||||
|
||||
{% include common/strftime_format.md title="strftime" %}
|
Loading…
Reference in New Issue