Skip to content

Kirby 6.0.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

First day of the week

In the Panel, the first day of the week is chosen based on user language or the date.weekday config option (0 for Sunday … 6 for Saturday):

site/config/config.php
return [
    'date' => [
        'weekday' => 0
    ]
];