nerdexam
Zend

200-550 · Question #219

Which of the following will NOT instantiate a DateTime object with the current timestamp?

The correct answer is D. $date = new DateTime(time()). See the full explanation below for the reasoning.

Question

Which of the following will NOT instantiate a DateTime object with the current timestamp?

Options

  • A$date = new DateTime();
  • B$date = new DateTime('@' . time());
  • C$date = new DateTime('now');
  • D$date = new DateTime(time());

How the community answered

(35 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    11% (4)
  • D
    83% (29)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice