Home / CSE / PHP - CS :: Date and Timestamp

CSE :: PHP - CS

  1. How many methods does the DateTime class have?

  2. A.

     8

    B.

     9

    C.

     10

    D.

     11


  3. How many constants does the DateTime class have?

  4. A.

     8

    B.

     9

    C.

     10

    D.

     11


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

  6. A.

     DateTime::format()

    B.

     DateTime::modify()

    C.

     DateTime::setTime()

    D.

     DateTime::setDate()


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

  8. A.

     $date = get_Class(DateTime);

    B.

     $date = class DateTime;

    C.

     $date = new DateTime();

    D.

     $date = new class DateTime();


  9. 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')

    ?>

  10. A.

     Sunday, February 24th 2008

    B.

     Sunday, 02 24 2008

    C.

     Sunday, 24 02 2008

    D.

     Sunday, 24th February 2008


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

  12. A.

     date_set_timezone(‘Europe/London’);

    B.

     date_default_timezone_set(‘Europe/London’);

    C.

     date_set_default_timezone(‘Europe/London’);

    D.

     date_default_timezone(‘Europe/London’);


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

  14. A.

     1

    B.

     2

    C.

     3

    D.

     4


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

  16. A.

     1

    B.

     2

    C.

     3

    D.

     4


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

  18. A.

     $date->modify(‘+2 months’);

    B.

     $date = modify(‘+2 months’);

    C.

     $date = modify(‘2+ months’);

    D.

     $date->modify(‘2+ months’);


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

  20. A.

     getOffset()

    B.

     getTranitions()

    C.

     ISODate()

    D.

     savingTime()