submitted by:

PHP: format date to mysql datetime

Convert the current date and time to MySQL datetime format using PHP's date() function.


code snippet:
<?php
//formats current date and time to datetime format
//for example:    2004-09-22 21:21:29

$mysqlDatetime date("Y-m-d G:i:s");

?>