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;
}
?>
January 6th, 2006 at 7:55 pm
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”);
January 7th, 2006 at 4:50 pm
Haha, all that work and you didnt realise the date() function. Sucker!
January 9th, 2006 at 8:29 pm
I hear you both, and I can’t understand why this snippet was added by me at all. It must’ve been someone else ;)
January 9th, 2006 at 8:30 pm
(I’ve updated the snippet as well)