{date:format:timestamp:no_date_text:zone}

Description

Formats a date or time using a PHP date() format string. The timestamp is a Unix timestamp; if you omit it the current time is used. A timestamp given as text (for example 2008-07-01 or the phrase next Monday) is first run through PHP strtotime(). If you omit the format too, date returns the raw Unix timestamp (PHP format "U"). The format parameter also accepts a PHP DATE_* constant name such as DATE_RFC2822 or DATE_ATOM. The third parameter, no_date_text, is printed instead when the timestamp is empty or within one day of zero, which is how AA marks an unset date field. The fourth parameter, zone, set to GMT, formats in UTC (PHP gmdate) instead of the server timezone. Note: the same colon that separates arguments will also split a literal clock time like 10:30, so format such a value from a field rather than typing it inline. The now expression is an alias for date and shares its first two parameters.

Parameters

format optional default U

A PHP date() format string, such as j.n.Y or Y-m-d. It also accepts a PHP DATE_ constant name like DATE_ATOM or DATE_RFC2822. If you omit it, date returns the raw Unix timestamp, which is PHP format U. A colon inside a time format must be escaped as hash-colon so it is not read as an argument separator.

Allowed values PHP date format string controlling the output. Accepts any format characters supported by PHP date(). Also accepts PHP predefined date constants as a string (e.g. DATE_RFC3339). If omitted, the expression returns the raw Unix timestamp (format "U").
timestamp optional default current time

The point in time to format, as a Unix timestamp. You normally pass a date field here. A value given as text, for example 2008-07-01 or the phrase next Monday, is parsed by PHP strtotime first. If you omit it, the current time is used.

Allowed values The date/time value to format. Accepts a Unix timestamp (integer) or any date string that PHP strtotime() can parse (e.g. "2024-01-15", "next Monday"). In item templates, this is usually a field alias such as {publish_date........} or {expiry_date.....}. If omitted or empty, the current time is used.
no_date_text optional default (off)

Text to print when the timestamp is unset. AA treats an empty or zero timestamp, meaning anything within one day of zero, as no date. If you leave this parameter out, an unset date is formatted normally and shows a date near 1 January 1970.

Allowed values Optional fallback text returned when the timestamp value is empty or zero (all of 1.1.1970 is treated as "no date"). Must be provided explicitly to activate fallback behavior — if you omit this parameter, the expression always formats the date even when empty. Useful to suppress date output on items where the date field has not been filled in.
zone optional default server timezone

Set this to GMT to format the time in UTC, using PHP gmdate. Any other value, or leaving it out, formats in the server timezone. To reach this fourth parameter you must also supply the third one, so use an empty third argument if you do not need fallback text.

Allowed values Optional timezone modifier. The only accepted value is "GMT" — when provided, the expression uses PHP gmdate() instead of date(), producing output in UTC time. Useful for generating machine-readable timestamps (e.g. RSS pubDate, HTTP headers) that must be timezone-independent.

Examples

virtual{date:Y}
Expected(the current year, for example 2026)
Actual2026
With only a format and no timestamp, date uses the current time. Y is the four-digit year. This output changes with the calendar, so it is shown as illustrative.
test{date:j.n.Y:0:not set}
Expectednot set
Actualnot set
The third parameter is printed when the date is unset. AA treats an empty or zero timestamp (anything within one day of zero) as no date, so this shows the fallback text instead of a 1970 date.
test{date:j.n.Y:1700000000}
Expected14.11.2023
Actual14.11.2023
The second parameter is a Unix timestamp. Here 1700000000 is formatted as day.month.year. In a template you would pass a date field such as a publish date in place of the number.
test{date:DATE_ATOM:1700000000::GMT}
Expected2023-11-14T22:13:20+00:00
Actual2023-11-14T22:13:20+00:00
The format accepts a PHP DATE_ constant such as DATE_ATOM for machine-readable timestamps. The empty third parameter keeps the no-date fallback unused, and the fourth parameter GMT formats in UTC instead of the server timezone.
test{date:Y-m-d:2008-07-01}
Expected2008-07-01
Actual2008-07-01
A timestamp given as text is parsed by PHP strtotime first, so you can reformat one date layout into another. Here a yyyy-mm-dd input is returned as yyyy-mm-dd, but any PHP date() format works.
test{date:H#:i:1700000000}
Expected23:13
Actual23:13
A time format needs a colon between hours and minutes, but a bare colon would start a new argument. Escape it as a hash-colon so the parser keeps H:i in the format. Output is in the server timezone (Europe/Prague).