Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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 Download Wow Hits 2010 2011 


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

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}