[eluser]quasiperfect[/eluser]
hi
can anyone spot the bug in this code because i'm going nuts.
thanks a lot
Code:
function to_timestamp($str) {
$segmente = explode(" ",$str);
$data = explode("-",$segmente[0]);
$timp = explode(":",$segmente[1]);
$timestamp = mktime($timp[0], $timp[1], $timp[2], $data[1], $data[2], $data[0]);
return $timestamp;
}
$str="2008-11-07 10:02:00";
$timestamp = to_timestamp($str);
echo 'this script should return '.$str.' insted is returning '.date("Y-m-d H:m:s",$timestamp).'<br />';
for
Code:
$str="2008-10-07 13:02:40"
this script should return 2008-10-07 13:02:40 insted is returning 2008-10-07 13:10:40
after some random testing i observed that the month is passed to the minutes
change the month to any month and see the result at minutes