Issue with strftime() expects parameter 2 to be long

Hi there,

I have turned on strftime in my config file and now want to display the date I entered in my structure by using strftime. It works with the normal date handler but not with strftime.

The error I get:

strftime() expects parameter 2 to be long, object given

I tried using a morale date field without putting it inside a structure and have also searched all over the internet without any success. I have to admit its probably a stupid mistake on my side because strftime is running just fine on another site of mine also running Kirby.

Here is my code:

<?php if($site->urlaub() != ''): $next_holiday = $site->urlaub()->toStructure()->nth(0); ?>			
<div class="banner"><b>Bitte beachten Sie:</b> Unsere Praxis ist vom <?php echo strftime('%B %Y', $next_holiday->start()) ?> bis zum <?= $next_holiday->end('%A, %e. %B'); ?> geschlossen.</div>
<?php endif ?>

And my Blueprint:

  urlaub:
    label: Urlaub
    type: structure
    style: table
    entry:
      - start
      - end
    fields:
      start:
        label: Beginn
        type:  date
      end:
        label: Ende
        type:  date

Thanks for any help in advance!

Use $next_holiday->start()->value(), otherwise, you pass a field object, not the timestamp.

Now there is a new Issue:

A non well formed numeric value encountered

Ah, the field is not called date, so we have to work around this:

strftime('%B %Y', $next_holiday->date(null, start()));

Should work. If not

strftime('%B %Y', strtotime($next_holiday->start()->value()));

The second option worked. Thanks a lot!