Log in

View Full Version : strtotime - Converting Dates



nikomou
04-04-2009, 10:17 AM
Hello,

How could i convert the string "18/04/2009" into the format "Sat 18th Apr 09"

I've tried using this:




$EventDate = strtotime("$EventDate");
$EventDate = date('D jS M y', $EventDate);



But this doesnt work as the string isnt in the correct format :(

techietim
04-04-2009, 11:18 AM
function eventDataConvert($date){
list($day, $month, $year) = explode('/', $date);
$time = mktime(0, 0, 0, $month, $day, $year);
return date('D jS M y', $time);
}