# 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`

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

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

### `intl`

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

<info>
The `intl` handler requires the PHP `intl` extension.
</info>

## Date formats

Note that the format syntax differs depending on date handler:

### `date` handler

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

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

### `strftime` handler

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

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

### `intl` handler

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

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

<since v="5.0.0">
## 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):

```php "site/config/config.php"
return [
	'date' => [
		'weekday' => 0
	]
];
```
</since>