php get current date

You can get current date in php using getdate().This function return array of options like seconds,minutes,hours,mday, and other options.You can also get date uing date function of php.Here i am presnting you some examples how to get current date in php.

    echo "Current seconds=".$dateArray['seconds'];
    echo "Current minutes=".$dateArray['minutes'];
    echo "Current hours=".$dateArray['hours'];
    echo "Current mday=".$dateArray['mday'];
    echo "Current wday=".$dateArray['wday'];
    echo "Current mon=".$dateArray['mon'];
    echo "Current year=".$dateArray['year'];
    echo "Current yday=".$dateArray['yday'];
    echo "Current weekday=".$dateArray['weekday'];
    echo "Current month=".$dateArray['month'];
    echo "another way ";
    echo "Current year=".date('Y');
    echo "Current month=".date('m');
    echo "Current date=".date('d');
    echo "Current hour=".date('H');
    echo "Current minutes=".date('i');
    echo "Current seconds=".date('s');
    echo "Current am/pm =".date('a');

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.