You would use DateTime as follows:
$time = new DateTime; echo $time->format(DateTime::ATOM);
The constructor ( new DateTime ) expects the time during which you want to create the object; the format does not matter at the moment. You specify the format for time output.
Having said that, the error you get seems rather unrelated and may have nothing to do with this particular line.
source share