nerdexam
Zend

200-710 · Question #61

QUESTION 64 Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'?

The correct answer is C. $datetime->format('Y-m-d H:i:s'). See the full explanation below for the reasoning.

Question

QUESTION 64 Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01'?

Options

  • A$datetime->format('%Y-%m-%d %h:%h:%s')
  • B$datetime->format('%Y-%m-%d %H:%H:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))
  • C$datetime->format('Y-m-d H:i:s')
  • D$date = date('Y-m-d H:i:s', $datetime);

How the community answered

(45 responses)
  • A
    4% (2)
  • B
    13% (6)
  • C
    76% (34)
  • D
    7% (3)

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice