Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Date and Time in PHP

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 132
    Comment on it

    The date function in PHP is the one which formats the timstamp to a readable form. The Syntax of it is as :

    date(format,timestamp)
    

    The required format function is to specify the format of the date and the timestamp Specifies default current date and time.

    Here are commonly used format specifiers :

    d - Day of the month (01 to 31)
    m - Month (01 to 12)
    Y - Year (in four digits)

    example :

    <?php
    echo "Today is " . date("Y/m/d") . "<br>";
    echo "Today is " . date("Y.m.d") . "<br>";
    echo "Today is " . date("Y-m-d") . "<br>";
    echo "Today is " . date("l");
    ?>
    

    output

    Today is 2015/12/21
    Today is 2015.12.21
    Today is 2015-12-21
    Today is Monday

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: