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