Free 200-550 Exam Braindumps (page: 16)

Page 15 of 56

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

  1. $date = new DateTime();
  2. $date = new DateTime('@' . time());
  3. $date = new DateTime('now');
  4. $date = new DateTime(time());

Answer(s): D



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'?

  1. $datetime->format('%Y-%m-%d %h:%i:%s')
  2. $datetime->format('%Y-%m-%d %h:%i:%s', array('year', 'month', 'day', 'hour', 'minute', 'second'))
  3. $datetime->format('Y-m-d H:i:s')
  4. $date = date('Y-m-d H:i:s', $datetime);

Answer(s): C



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');

  1. $date2 > $date1
  2. $date2 < $date1
  3. $date1->diff($date2) < 0
  4. $date1->diff($date2) > 0

Answer(s): A



Given the following DateTime object, which sample will NOT alter the date to the value '2014-02- 15'?
$date = new DateTime('2014-03-15');

  1. $date->sub(new DateInterval('P1M'));
  2. $date->setDate(2014, 2, 15);
  3. $date->modify('-1 month');
  4. $date->diff(new DateInterval('-P1M'));

Answer(s): D






Post your Comments and Discuss Zend 200-550 exam with other Community members:

200-550 Discussions & Posts