Parsing Kirby date

Hi, I’m no php coder but I’m trying to translate date in a kirby templates.

I have a starting and a finishing date named “starting” and “finishing” with a date type in the blueprint.

I’ve try to follow this post:

I’ve called the date in the template with the following code:

<h3><?php echo $page->starting('d m Y')->html() ?> — <?php echo $page->finishing('d m Y')->html() ?></h3>

in the config with I’ve added:

c::set('locale', 'fr_FR');
c::set('date.handler', 'strftime');
c::set('starting.handler', 'strftime');
c::set('finishing.handler', 'strftime');

But I’m still getting this result:
2016-02-02 — 2016-02-02

I’d like to have it:
02.02.2016 – 02.02.2016

even better would be if the same year to have:
02.02 – 02.02.2016

Many thanks for any help.

Nicolas

See this post for a solution

Wonderful. Many thanks.
How about a condition in php to hide the “–” if the end date is missing?

N

<?php if($page->finishing()): ?>
  $endDate = strtotime($page->finishing());
 echo ' - ' . date('Y', $endDate); //etc.
<?php endif; ?>

So nice. Many thanks.