Dates In MySQL And PHP
Join the DZone community and get the full member experience.Join For Free
// $mysqldate is ready to be inserted into a DB // $phpdate is ready to used in a PHP script
// For use with DATESTAMP type or TIMESTAMP type $mysqldate = date( 'Y-m-d H:i:s', $phpdate ); $phpdate = strtotime( $mysqldate ); // For use with DATE type $mysqldate = date( 'Y-m-d', $phpdate ); // H:i:s will be 00:00:00 $phpdate = strtotime( $mysqldate );
Opinions expressed by DZone contributors are their own.