Zend
200-710 · Question #62
QUESTION 65 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.
Date and Time
Question
QUESTION 65
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
(25 responses)- A84% (21)
- B8% (2)
- C4% (1)
- D4% (1)
Topics
#DateTime#object comparison#date comparison#comparison operators
Community Discussion
No community discussion yet for this question.