PHP

PHP

Working with Dates has 9 Questions
How many methods does the DateTime class have?

8
9
10
11
How many constants does the DateTime class have?

8
9
10
11
Which method is simply an object-oriented version of date()?

DateTime::format()
DateTime::modify()
DateTime::setTime()
DateTime::setDate()
Which of the following is the right way to use the DateTime class?

$date = get_Class(DateTime);
$date = class DateTime;
$date = new DateTime();
$date = new class DateTime();
Which of the following statements can be used to set the time zone in individual scripts?

date_set_timezone('Europe/London');
date_default_timezone_set('Europe/London');
date_set_default_timezone('Europe/London');
date_default_timezone('Europe/London');
Among the four PHP DateTimeZone classes given below how many are static? i) listAbbreviations() ii) getName() iii) getOffset() iv) listIdentifiers()

1
2
3
4
Among the four PHP DateTimeZone classes given below how many are nonstatic? i) _construct() ii) getName() iii) getOffset() iv) getTransitions()

1
2
3
4
Which of the following statements can be used to add two months to the existing date?

$date->modify('+2 months');
$date = modify('+2 months');
$date = modify('2+ months');
$date->modify('2+ months');
Which method enables you to calculate whether daylight saving time is in force at a specific date and time?

getOffset()
getTranitions()
ISODate()
savingTime()