Over a million developers have joined DZone.

Any Date To Mysql Date

DZone's Guide to

Any Date To Mysql Date

· ·
Free Resource
a little helper function which parses about any date and returns the same date in MySQL date/time format 

function date_to_mysql($date) {
    //if $date is not numeric, assume it's in textual format
    if (!is_numeric($date)) {
    return date('Y-m-d H:i:s',$date);         

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}