The code below...
$date = "02-13-2012";
$start_time = "17:30";
$end_time = "20:00";
$start_timestamp = date("m-d-Y H:i",strtotime($date." ".$start_time));
$end_timestamp = date("m-d-Y H:i",strtotime($date." ".$end_time));
print($start_timestamp);
print($end_timestamp);
Returns...
1969-12-31 19:30:00
1969-12-31 20:30:00
Does anyone have any idea why this is not working correctly?
See this. I think you have to change the date format.
$date = "02-13-2012";
$date = str_replace("-","/",$date);
$start_time = "17:30";
$end_time = "20:00";
$start_timestamp = date("m-d-Y H:i",strtotime($date." ".$start_time));
$end_timestamp = date("m-d-Y H:i",strtotime($date." ".$end_time));
print($start_timestamp);
echo "<br/>";
print($end_timestamp);
0 comments:
Post a Comment