brown2005 Posted March 4, 2007 Share Posted March 4, 2007 I knew how to do this but I have totally forgot, i have $date = $array['date']; which is 2007-04-05 how do i turn into 05-04-2007 thanks Link to comment https://forums.phpfreaks.com/topic/41175-date/ Share on other sites More sharing options...
fert Posted March 4, 2007 Share Posted March 4, 2007 $temp=explode("-",$date); $date=$temp[2]."-".$temp[1]."-".$temp[0]; Link to comment https://forums.phpfreaks.com/topic/41175-date/#findComment-199485 Share on other sites More sharing options...
JBS103 Posted March 5, 2007 Share Posted March 5, 2007 This is the exact same thing, but you have some flexibility in using the date function: <?php $date = "2007-04-05"; $temp = explode("-",$date); echo date("d-m-Y", mktime(0, 0, 0, $temp[1], $temp[2], $temp[0])); ?> What was previously posted is also legitimate and might be easier, but this will help you out if you ever want a different format. Link to comment https://forums.phpfreaks.com/topic/41175-date/#findComment-199497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.