- var_dump: documentation ( source)
- printf: documentation ( source)
<?php
$now = new DateTime('now');
$date = DateTime::createFromFormat('YmdHis', '2004' . $now->format('md') . '000000');
$diff = $date->diff($now, true);
printf(
'Got %s and expected %s',
$now->sub($diff)->format(DateTime::ISO8601),
$date->format(DateTime::ISO8601)
);
var_dump($diff);