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" |
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, month, and four digit year with dots or dashes | "30-06-2018", "14.7.1942" |
Day, textual month, and year | "30-June 2009", "22DEC19" |
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 | Examples |
---|---|---|
yesterday | Midnight of yesterday or yesterday at a specific time | "yesterday" "yesterday 10:30" "yesterday 8:32pm" |
midnight | Midnight today | "midnight" |
today | Today with the time set to midnight | "today" |
now | The current date and time | "now" |
noon | Noon today or noon for the date | "noon" "June 15 noon" "noon 10/20/2019" |
tomorrow | Tomorrow at midnight | "tomorrow" |
'back of' hour | 15 minutes past the specified hour today or the specified date | "back of 7pm" "back of 14" "June 15, 2019 back of 6am" "back of 7 2020-01-24" |
'front of' hour | 15 minutes before the specified hour today or the specified date | "front of 8pm" "front of 15" "June 1, 2001 front of 8" "front of 10 2020-10-19" |
first day of | Sets the day to the first of the current month, or the specified month | "first day of" "first day of June" "first day of June 2018" "first day of 2018-10" |
last day of | Sets the last day of the current month, or the specified month | "last day of" "last day of May" "last day of May 1999" "last day of 2010-9" |
ordinal dayname of | Calculates the x-th weekday of the specified month. | "first saturday of June" "second sunday of July 1999" |
ordinal dayname from now | Calculates the x-th weekday from the current date | "first sat" "second sunday" |
last dayname of month | Calculates the last specified weekday of the specified month | "last saturday of June" "last Monday of December, 2019" |
last dayname from now | Calculates the previous specified weekday from the current date | "last saturday" "last wednesday" "last wed" |
# unit | Sets relative time items where the value is a number | "+5 weeks" "12 day" "-7 weekdays" "-2 months" |
ordinal unit | Handles relative time items where the value is text | "fifth day" (5 days from now) "second month" (2 months from now) |
ago | Negates all of the previously found relative time items | "2 days ago" "8 days ago 14:00" (8 days ago at 14:00) "2 months 5 days ago" "2 months ago 5 days" (2 months ago + 5 days) "8 weekdays ago" |
dayname | Moves to the next day of this name | "Monday" |
relative text 'week' | Handles the special format of "weekday + last/this/next week" | "Monday next week" "Tuesday this week" "Wed last week" |