Snippet Name: Almost any date to Mysql date
Description: Handy helper function which parses about any date and returns the same date in MySQL date/time format.
Comment: (none)
Language: MYSQL
Highlight Mode: MYSQL
Last Modified: March 01st, 2009
|
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);
} |