{changedate:item_id:field_id:format}

Description

Returns the date of the last recorded change to one field of an item, formatted like the date command. It takes the item id, the field id (the selector of the field to inspect), and an optional date format. Internally it looks up the item edit history (the change log) for that field and passes the timestamp to the date command, so format accepts the same patterns as date - for example Y-m-d, j.n.Y, or a DATE_ constant such as DATE_ATOM. When format is empty the result is a raw Unix timestamp (the date default). If the item id is not a valid item id, the field id is empty, or that field has no recorded change, the time is zero and the command returns a fixed two-dash placeholder shown as a double dash; this placeholder is built in and cannot be overridden. History is only recorded when the slice has history logging enabled (the historylog slice property is not set to 0) and the field was actually changed by an update - inserts are not logged, and the last_edit field is ignored. The everyday use is showing when a field was last edited, passing the current item id alias _#ITEM_ID_ as the first argument, a field selector as the second, and a human date format as the third. Related commands: changed lists which fields changed in the last edit, history returns past values of a field, and lastedit gives the slice-wide last modification date.

Parameters

item_id required default (none)

Long (32 hex) id of the item whose change history is inspected. Usually the current item id alias _#ITEM_ID_. If it is not a valid item id the command returns the double-dash placeholder.

field_id required default (none)

Field selector (field id) of the field whose last change date you want, for example body............. or price............ Required; an empty field id returns the double-dash placeholder.

format optional default (empty - raw Unix timestamp)

Date format passed straight to the date command - any date pattern (Y-m-d, j.n.Y) or a DATE_ constant (DATE_ATOM). Empty format yields a raw Unix timestamp.

Examples

test[{changedate:notanid:headline........:Y-m-d}]
Expected[--]
Actual[--]
When the first argument is not a valid item id the time is zero, so the result is the built-in double-dash placeholder. The square brackets are only there to make the empty-looking output visible.
test[{changedate:5726c2c6b035d7aab450d1794e9e90d7::Y-m-d}]
Expected[--]
Actual[--]
The field id (second argument) is required. An empty field id also yields the double-dash placeholder, even when the item id is valid.
test[{changedate:5726c2c6b035d7aab450d1794e9e90d7:headline........:Y-m-d}]
Expected[--]
Actual[--]
A real item and a real field, but this field has no change recorded in the history log (history logging is off for this slice), so the lookup returns zero and you get the placeholder. This is the normal result until a field is actually edited on a history-logging slice.
test[{changedate:5726c2c6b035d7aab450d1794e9e90d7:integer.........}]
Expected[--]
Actual[--]
With no format argument the date command would print a raw Unix timestamp. Here the field still has no recorded change, so the placeholder wins. When a change does exist and format is empty, the output is a Unix timestamp such as 1735056000.
virtualUpdated: {changedate:_#ITEM_ID_:body.............:j.n.Y}
Expected(Updated: 24.12.2024)
ActualUpdated: --
The everyday pattern in an item template or listing: pass the current item id alias as the first argument, the field selector as the second, and a human date format as the third. The output depends on the real edit history of the item, so it is shown as an example value.
virtual{changedate:_#ITEM_ID_:price...........:DATE_ATOM}
Expected(2024-12-24T18:30:00+01:00)
Actual--
Using a DATE_ constant gives a full date-and-time string, handy in an edit notification next to the changed command (which lists which fields changed). Runtime-dependent on the item history, hence an example value.