# Problem with strftime

**URL:** <https://forum.getkirby.com/t/problem-with-strftime/10079>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 26, 2018, 2:32pm UTC](https://forum.getkirby.com/t/problem-with-strftime/10079 "2018-03-26T14:32:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![firstklaas](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@firstklaas](https://forum.getkirby.com/u/firstklaas)\
**Post date:** [March 26, 2018, 2:32pm UTC](https://forum.getkirby.com/t/problem-with-strftime/10079/1 "2018-03-26T14:32:25Z")

</div>

I’m using this code to display the month in a timeline in an abbreviated way. This needs to be translated in two languages.

```
<?php $somedate = $event->event_datum(); echo date('M Y', strtotime($somedate)) ?>

```

In another topic, i read i would need _strftime_ for this. When i use this code

```
<?php $somedate = $event->event_datum(); echo strftime('M Y', $somedate) ?>	

```

I get the error: strftime() expects parameter 2 to be integer, object given

Could you tell me why i get the error and how i can fix this? Thank you!

---

<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:** [March 26, 2018, 2:46pm UTC](https://forum.getkirby.com/t/problem-with-strftime/10079/2 "2018-03-26T14:46:23Z")

</div>

First of all, you could set the date handler to strftime in your config:

```auto
c::set('date.handler','strftime');

```

You can then use the date method

```auto
<?php echo $page->date('%b %G', 'event_datum') ?>

```

Note that the formatting is different for strftime.

The error you get is caused because `$page->event_datum()` returns a field object, not an integer. You’d have to convert that to a Unix timestamp first using `strtotime()`. But if you do what I suggested above, you don’t have to do this.

---

<div class="post-metadata">

**Author:** ![firstklaas](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@firstklaas](https://forum.getkirby.com/u/firstklaas)\
**Post date:** [March 26, 2018, 3:06pm UTC](https://forum.getkirby.com/t/problem-with-strftime/10079/3 "2018-03-26T15:06:42Z")

</div>

Ok, i got it! Thank you.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:28pm UTC](https://forum.getkirby.com/t/problem-with-strftime/10079/4 "2025-02-06T17:28:32Z")

</div>


