PHP Date/Time
- What will be the output of the following PHP code if date is 15/03/2019?
<?php
$date = new DateTime();
echo $date->format('l,F,js,Y')
?>
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The format() method displays the date in same way as standard date function().
- Which of the following statements can be used to set the time zone in individual scripts?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
You can also use ini_set(‘date.timezone’, ‘Europe/London’);.
- Among the four PHP DateTimeZone classes given below how many are static?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
listAbbreviations() and listIdentifiers() are static methods.
- Among the four PHP DateTimeZone classes given below how many are non static?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
All of the given methods are non static.
- Which of the following statements can be used to add two months to the existing date?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
To change the date stored by a DateTime object after it has been created, you use DateTime::modify() with a natural language expression.