This documentation describes unreleased changes on the main branch.

wp_date()

Twig function of the framework; its result is escaped like any value.

{{ wp_date(format, timestamp = null) }}

A Unix timestamp formatted in the site's time zone and language, as returned by wp_date(), as text. Without a timestamp it formats the current time; a block with #[Cache] cannot do that: the call throws an error there.

<time>{{ wp_date('j. F Y', attrs.timestamp) }}</time>
ParameterTypeDefaultDescription
formatstringrequiredPHP date format, e.g. j. F Y.
timestampint|nullnullUnix timestamp; null for now.

Returns string