Exam4Training

Given the following DateTime objects, what can you use to compare the two dates and indicate that $date2 is the later of the two dates?

Given the following DateTime objects, what can you use to compare the two dates and indicate that $date2 is the later of the two dates?

$datel = new DateTime(‘2014-02-03’);

$date2 = new DateTime(‘2014-03-02’);
A . $date2 > $datel
B . $date2 < $datel
C . $datel->diff($date2) < 0
D . $datel->diff($date2) > 0

Answer: A

Exit mobile version