Vidyalelo
PHP · all questions

Date And Timestamp
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

30

Questions

1/2

Page

Pick an option on a question to see the right answer and solution.

What will be the output of the following PHP code?
<?php
    echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');
?>

Select an option to see the answer and solution.

The date() function returns ___ representation of the current date and/or time.

Select an option to see the answer and solution.

Which one of the following format parameter can be used to identify timezone?

Select an option to see the answer and solution.

If the format is F then which one of the following will be returned?

Select an option to see the answer and solution.

What will be the output of the following code? If say date is 22/06/2013.
<?php
    echo "Today is ".date("F d, Y")
?>

Select an option to see the answer and solution.

Which one of the following function is useful for producing a timestamp based on a given date and time.

Select an option to see the answer and solution.

Which function displays the web page’s most recent modification date?

Select an option to see the answer and solution.

What will be the output of the following PHP code? If say date is 22/06/2013.
<?php
    printf( date("t") )
?>

Select an option to see the answer and solution.

Say you want to calculate the date 45 days from the present date which one of the following statement will you use?

Select an option to see the answer and solution.

To create an object and set the date to JUNE 22, 2013, which one of the following statement should be executed?

Select an option to see the answer and solution.

How many methods does the DateTime class have?

Select an option to see the answer and solution.

How many constants does the DateTime class have?

Select an option to see the answer and solution.

Which method is simply an object-oriented version of date()?

Select an option to see the answer and solution.

Which of the following is the right way to use the DateTime class?

Select an option to see the answer and solution.

What will be the output of the following PHP code if date is 24/02/2008?
<?php
$date = new DateTime();
echo $date->format('l,F,js,Y')
?>

Select an option to see the answer and solution.

Which of the following statements can be used to set the time zone in individual scripts?

Select an option to see the answer and solution.

Among the four PHP DateTimeZone classes given below how many are static? 1. listAbbreviations() 2. getName() 3. getOffset() 4. listIdentifiers()

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following statements can be used to add two months to the existing date?

Select an option to see the answer and solution.

Which method enables you to calculate whether daylight saving time is in force at a specific date and time?

Select an option to see the answer and solution.