Skip to content

Kirby 4.5.0

date

Setup date handling

Date handler

Determines which PHP function is used to format dates for pages and files.

Possible values: date | strftime | intl (default: date)

strftime

return [
  'date'  => [
    'handler' => 'strftime'
  ]
];

The underlying strftime() function is deprecated since PHP 8.1. We strongly recommend new projects to use the intl handler instead.

intl

return [
  'date'  => [
    'handler' => 'intl'
  ]
];

The intl handler requires the PHP intl extension.

Date formats

Note that the format syntax differs depending on date handler:

date handler

echo $page->date()->toDate('Y-m-d');

All formats: https://www.php.net/manual/de/function.date.php

strftime handler

echo $page->date()->toDate('%Y-%m-%d');

All formats: https://www.php.net/manual/en/function.strftime

intl handler

echo $page->date()->toDate('EEEE, MMMM d, YYYY');

All formats: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax