Date Input Formats
These formats are used if you are supplying a date to a filter or function like the date_diff filter or time_ago filter.
If you are outputting a date using the the date filter or the _core.date variable then you'll want to use the standard date formats.
Timestamp
The simplest value to supply is a timestamp.
{{ 1608755722|date_diff }}
Most app items supply a updatedOnTimestamp value. You can use it like this:
{{ post.updatedOnTimestamp|time_ago }}
Time Formats
When you're specifying a date using date formats you can also specify the time. Or, if you only specify the time then the current date is used. For example:
{{ '10/20/2020 10:32 pm'|date_diff }}
12 hour notation
The space before the meridian in each format is optional.
Description | Examples |
---|---|
Hour only, with meridian. | "4 am", "06PM" |
Hour and minutes with meridian. "4:30am", "10:15 PM", "08:00pm" | "4:30am", "10:15 PM", "08:00pm" |
Hour, minutes and seconds with meridian. | "05:32:23pm", "10:15:32 PM", "9:30:00 am" |
24 hour notation
Description | Examples |
---|---|
Hour and minutes | "04:08", "19:32" |
Hour, minutes, and seconds | "4:30:40", "15:01:32" |
Date Formats
The time will be set to midnight
Description | Examples |
---|---|
American month and day (month/day) | "4/12", "10/20" |
American month, day, and year (month/day/year) | "4/12/6", "4/12/15", "4/12/2005" |
Four digit year, month, and day with slashes | "2020/4/25", "2019/05/01" |
Four digit year and month (GNU) | "2016-5", "2016-05", "1979-11" |
Year, month, and day with dashes | "2008-10-20", "08-10-20", "8-10-20" |
Day, textual month, and year | "30-06-2018", "14.7.1942" |
Textual month and four digit year. The day is set to "1" | "June 2009", "DEC2020", "dec2020" |
Four digit year and textual month. The day is set to "1" | "2019 November", "2019nov", "2019 nov", "2019NOV" |
Textual month, day and year | "July 1st, 2019", "July 1, 2019", "July.1.19" |
Textual month and day. The year is set to the current year. | "July 1st", "July 19", "May.9" |
Day and textual month. The year is set to the current year. | "1 July", "17 Apr", "9.May" |
Month abbreviation, day, and year | "May-09-92", "Apr-17-2020" |
Year, month abbreviation, and day | "79-Dec-22", "1992-may-02" |
Textual month. The year and day are set to the current | "May", "June", "Jul" |
Date and Time
You can combine any of the date and time combinations above. It does not matter if the date or the time is first.
For example:
"2020/10/1 8:30pm" or "8:30pm 2020/10/1"
Relative formats
Format | Description |
---|---|
yesterday | Midnight of yesterday or yesterday at a specific time. Examples: "yesterday" |
midnight | Midnight today. Examples: "midnight" |
today | Today with the time set to midnight. Examples: "today" |
now | The current date and time. Examples: "now" |
noon | Noon today or noon for the date. Examples: "noon"
|
tomorrow | Tomorrow at midnight. Examples: "tomorrow" |
'back of' hour | 15 minutes past the specified hour today or the specified date. Examples: "back of 7pm" |
'front of' hour | 15 minutes before the specified hour today or the specified date. Examples: "front of 8pm"
|
first day of | Sets the day to the first of the current month, or the specified month. Examples: "first day of"
|
last day of | Sets the last day of the current month, or the specified month. Examples: "last day of" |
ordinal dayname of | Calculates the x-th weekday of the specified month. Examples: "first saturday of June" |
ordinal dayname from now | Calculates the x-th weekday from the current date. Examples: "first sat"
|
last dayname of month | Calculates the last specified weekday of the specified month Examples: "last saturday of June" |
last dayname from now | Calculates the previous specified weekday from the current date. Examples: "last saturday" |
# unit | Sets relative time items where the value is a number. Examples: "+5 weeks" |
ordinal unit | Handles relative time items where the value is text. Examples: "fifth day" (5 days from now)
|
ago | Negates all of the previously found relative time items. Examples: "2 days ago" |
dayname | Moves to the next day of this name. Examples: "Monday" |
relative text 'week' | Handles the special format of "weekday + last/this/next week". Examples: "Monday next week" |