# Correct Date Handler

**URL:** <https://forum.getkirby.com/t/correct-date-handler/18286>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 19, 2020, 9:10pm UTC](https://forum.getkirby.com/t/correct-date-handler/18286 "2020-05-19T21:10:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrfreedom](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mrfreedom/32/14018_2.png) [@mrfreedom](https://forum.getkirby.com/u/mrfreedom)\
**Post date:** [May 19, 2020, 9:10pm UTC](https://forum.getkirby.com/t/correct-date-handler/18286/1 "2020-05-19T21:10:12Z")

</div>

Hi, what is the correct Date Handler config code?

Like showed here [date | Kirby CMS](https://getkirby.com/docs/reference/system/options/date)

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

```

Or here [https://getkirby.com/docs/cookbook/text/dates#custom-date-handler](https://getkirby.com/docs/cookbook/text/dates#custom-date-handler)

```auto
return [
    'date.handler' => 'strftime'
];

```

On my server, both of them work, but it is better to check. The second one is maybe leftover from earlier versions.

And one more thing.

I saw that on some servers srtftime date is displayed like this %09.%05.%2019 on the front-end.  
With `%`. Could that be some locale related issue?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 19, 2020, 9:44pm UTC](https://forum.getkirby.com/t/correct-date-handler/18286/2 "2020-05-19T21:44:05Z")

</div>

Both options should work.

How do you output the date?

---

<div class="post-metadata">

**Author:** ![mrfreedom](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mrfreedom/32/14018_2.png) [@mrfreedom](https://forum.getkirby.com/u/mrfreedom)\
**Post date:** [May 19, 2020, 9:51pm UTC](https://forum.getkirby.com/t/correct-date-handler/18286/3 "2020-05-19T21:51:53Z")

</div>

Like this

`<?= $article->date()->toDate('%d.%m.%Y') ?>`

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [May 20, 2020, 8:18am UTC](https://forum.getkirby.com/t/correct-date-handler/18286/4 "2020-05-20T08:18:52Z")

</div>

> [@mrfreedom](#):
>
> \<?= $article-\>date()-\>toDate('%d.%m.%Y') ?\>

Use  
\<?= $article-\>date()-\>toDate('d.m.Y') ?\>

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 20, 2020, 8:51am UTC](https://forum.getkirby.com/t/correct-date-handler/18286/5 "2020-05-20T08:51:03Z")

</div>

> [@Adspectus](#):
>
> \<?= $article-\>date()-\>toDate('d.m.Y') ?\>

Nope, with the date handler set to `strftime`, we have to use the `strftime` date format syntax: [PHP: strftime - Manual](https://www.php.net/manual/de/function.strftime.php)

---

<div class="post-metadata">

**Author:** ![mrfreedom](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mrfreedom/32/14018_2.png) [@mrfreedom](https://forum.getkirby.com/u/mrfreedom)\
**Post date:** [May 20, 2020, 9:12am UTC](https://forum.getkirby.com/t/correct-date-handler/18286/6 "2020-05-20T09:12:18Z")

</div>

In the meantime, I figured out that it is locale issue, and I am just wondering is there some relatively quick solution, without the need to check what locales are installed on a server.

On the server I have control of it is ok, but now is an issue on the server I do not have control of.

I know the easiest thing would be to turn of strftime and output as ‘d.m.Y’, in this case strftime is used for nothing special. But I have/had intent to use for something special.

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 20, 2020, 9:16am UTC](https://forum.getkirby.com/t/correct-date-handler/18286/7 "2020-05-20T09:16:15Z")

</div>

Did you have a locale set in Kirby in those cases where you got the % output?

---

<div class="post-metadata">

**Author:** ![mrfreedom](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mrfreedom/32/14018_2.png) [@mrfreedom](https://forum.getkirby.com/u/mrfreedom)\
**Post date:** [May 20, 2020, 9:58am UTC](https://forum.getkirby.com/t/correct-date-handler/18286/8 "2020-05-20T09:58:07Z")

</div>

No, I didn’t set any locale setup in config.

Client is from Scotland, and I told him to add  
`'locale' => 'en_GB.utf-8',`

To see does it make some difference.

---

<div class="post-metadata">

**Author:** ![mrfreedom](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mrfreedom/32/14018_2.png) [@mrfreedom](https://forum.getkirby.com/u/mrfreedom)\
**Post date:** [May 20, 2020, 1:01pm UTC](https://forum.getkirby.com/t/correct-date-handler/18286/9 "2020-05-20T13:01:02Z")

</div>

Problem solved.  
It is a reminder to always triple check stupid things first, and make sure they are ok.

The client’s config was set to `config.website.com.php` and he checked [www.website.com](http://www.website.com) all the time.  
In addition, he didn’t set non-www to www redirect and sent me [website.com](http://website.com). From my point, everything looked ok, but he constantly sent me screenshots with faulted dates with %. Which puzzled me.  
Until I figured it out.

At least, maybe this thread help someone with the same issue. Thanks!
