DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Reinis has posted 8 posts at DZone. View Full User Profile

Any Date To Mysql Date

  • submit to reddit
        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);