Hi everyone,
I have tried to convert some dates to UNIX for comparisons and I have not figured out how to correctly convert a date like:
I tried several ways with mktime and I get a date '1257175773' and that is a future date.
I understand that mktime wants (21, 18, 56, 06, 10, 2007) but with out exploding it and re-arranging it, I don't know of an easier way.
Thanks in advance,
Don
I resolved this with an explode. If there was a simpler way, please let me know.
function convert_datetime($str) {
list($date, $time) = explode(' ', $str);
list($year, $month, $day) = explode('-', $date);
list($hour, $minute, $second) = explode(':', $time);
$timestamp = mktime($hour, $minute, $second, $month, $day, $year);
return $timestamp;
}