0

I have this php code to get the difference between two dates:

$date1=date_create("01.06.2021");
$date2=date_create("05.06.2021");
$diff=date_diff($date1,$date2);
echo $diff->format("%R%a");

Result:

+4

But how can I realize this, wenn the format of $date1 is for example: 20210605T180000

Ghost108
  • 3,818
  • 8
  • 44
  • 89

0 Answers0