Zend
200-550 · Question #221
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? $date1 = new DateTime('2014-02-03'); $date2 = new…
The correct answer is A. $date2 > $date1. See the full explanation below for the reasoning.
Question
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? $date1 = new DateTime('2014-02-03'); $date2 = new DateTime('2014-03-02');
Options
- A$date2 > $date1
- B$date2 < $date1
- C$date1->diff($date2) < 0
- D$date1->diff($date2) > 0
How the community answered
(24 responses)- A71% (17)
- B4% (1)
- C17% (4)
- D8% (2)
Community Discussion
No community discussion yet for this question.