Date Variables
Built-in date values
The following values are available:
| Variable | Description |
|---|---|
| _core.date.day |
Holds the day of the month value as a number. It will be two digits with a leading zero if necessary. Examples:
{{ _core.date.day }} If you need the day of the week value use {{ _core.date.weekday }} |
| _core.date.isWeekday |
Holds whether the current day is a weekday (Monday, Tuesday, Wednesday, Thursday, or Friday). This is a boolean value. {% if _core.date.isWeekday %} |
| _core.date.isWeekend |
Holds whether the current day is a weekend day (Saturday or Sunday). This is a boolean value. {% if _core.date.isWeekend %} |
| _core.date.month |
Holds the month value as a number. It will be two digits with a leading zero if necessary. Examples:
{{ _core.date.month }} |
| _core.date.monthName |
Holds the full name of the month. Examples:
{{ _core.date.monthName }} |
| _core.date.timestamp |
Holds the numeric timestamp, which is the number of seconds since the Unix Epoch (January 1, 1970, 00:00:00 GMT). {{ _core.date.timestamp }} |
| _core.date.weekday |
Holds the full name of the current day of the week. Examples:
{{ _core.date.weekday }} |
| _core.date.weekdayNumber |
Holds the day of the week as a number. For example:
{{ _core.date.weekdayNumber }} The numbers correspond to the day of the week, starting with Sunday.
|
| _core.date.year |
Holds the numeric year for the current date as four digits. Examples:
{{ _core.date.year }} |
Set your own date values
You can set your own date values and reuse them later in the template.
{% set _core.date.today = 'now'|date('M d, Y') %}
... [Further down in the template ]
<p>Today is {{ _core.date.today }}</p>
Display the date with the date filter
If you need to get a custom date format for the current date then you can either use the special "now" value with the date filter, or you can use _core.date with the date filter.
Display the date a MONTH DAY, YEAR
{{ _core.date|date('F d, Y') }}