d.m.y -> unix time
Posted: Tue Oct 06, 2009 6:54 pm
I've got a lot of dates in d.m.y format. The time isn't that important. It could be d.m.y 00:00:01 or something. I tried this:But it didn't work out that well. I also tried the example at php.net:This returns:
Code: Select all
<?php
$date = explode('.', $fetch['date']);
echo date('U', mktime(0, 0, 1, $date[1], $date[0], $date[3]));
?>Code: Select all
<?php
echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
?>Jan-01-1998
Jan-01-1998
Jan-01-1998
Jan-01-1998