our site does festival reviews, and for this we want to be able to select a start date (datum) and an end date (eind\_datum) via date time picker custom fields. Ultimately we want a function that determines whether the start and end date have the some month, so we end up with something like this

'1-4 Juli 2020' (instead of '1 Juli - 4 Juli 2020).

When the month is different we want it to be displayed as follows
'30 Juni - 4 Juli 2020'.

I have tried several things but none seem to work, the month needs to be in Dutch, I tried setting the locale but that didn't help, and the following code below throws an error at this line
'$first = $startdateTime->format('F');'

Anybody out here who might help ?

```
 <?php  

$start_date = get_field('datum');
$end_date = get_field('eind_datum');
$startdatetime = DateTime::createFromFormat('Y-m-d H:i:s', $start_date);
$enddatetime = DateTime::createFromFormat('Y-m-d H:i:s', $end_date);
$first = $startdateTime->format('F');
$second = $enddateTime->format('F');

 if (get_field('eind_datum') and get_field('datum') and ($first == $second )) {
  echo  $start_date->format ('j'); echo "-"; echo $end_date->format ('j F Y') ;
 }
 elseif (get_field('eind_datum') and get_field('datum') and ($first != $second )) {
  echo  $start_date->format('j F'); echo "-"; echo $end_date->format ('j F Y') ; 
 }
 else {
  echo the_field('datum') ;
 }
 ?>

```