Use $page->date($format = false, $field = 'date') with form field not called date

Im my form field I have a begin date and an end date. On the page I want to show something like:

Year of begin date, month of begin date, day of begin date - day of end date.

But I didn’t find any possibility to extract the day (or year, or month) of any field that is of the type date, but not called date. Is there any possibility?

Sth. like this should work

<?php 
$begin_date = $page->begin_date();
$end_date = $page->end_date();

echo $begin_date('Y') .  "/" . $begin_date('m') . "/" . $begin_date('d') ?>
//etc.

When I try that, I get:

‘Fatal error: Function name must be a string in…’

and saying

echo $page->begin_date(‘Y’);

gives me the whole date, not only the year.

Oh, sorry, I made a mistake:

<?php 
$begin_date = strtotime($page->begin_date());
$end_date = strtotime($page->end_date());

echo date('Y', $begin_date) .  "/" . date('m', $begin_date) . "/" . date('d', $begin_date) ?>
//etc.
?>

Works perfectly :slight_smile: Thanks!