PHP Date/Time


  1. What will be the output of the following PHP code? If say date is 12/02/2019.
    <?php
    printf( date("t") )
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The t parameter is used to determine the number of days in the current month.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    mktime()



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The getlastmod() function returns the value of the page’s Last Modified header or FALSE in the case of an error.


  1. What will be the output of the following code? If say date is 30/05/2018.
    <?php
    echo "Today is ".date("F d, Y")
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    F is the parameter for complete text representation of month, d for day of month, and Y for 4 digit representation of year.



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The strtotime() function and GNU date syntax is used to calculating the date x days from the present date.