ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.

Advertisements

MySQL NOW()

Using this function you can get the current date and time in the MySQL NOW() form, in case you want to use PHP to generate it, instead of MySQL.

function mysql_now() {
    
$date date(”Y-m-d H:i:s”);
    return 
$date;
}
?>

4 Responses to “MySQL NOW()”

  1. BraveBrain Says:

    or you can use the built-in date() function.

    The following syntax will return the date in the same format as the above snippet

    date(”Y-m-d H:i:s”);

  2. Erin Says:

    Haha, all that work and you didnt realise the date() function. Sucker!

  3. Dennis Pallett Says:

    I hear you both, and I can’t understand why this snippet was added by me at all. It must’ve been someone else ;)

  4. Dennis Pallett Says:

    (I’ve updated the snippet as well)

Leave a Reply