liamloveslearning Posted June 29, 2010 Share Posted June 29, 2010 Hi all, I have a date which is being outputted as dd/mm/yyyy. I need to output it as yyyy-mm-dd. My script to output the date is <?php echo KT_escapeAttribute($row_rsmodel_login['dob']); ?> Cany anybody give me a pointer on how to convert this to yyyy-mm-dd? Link to comment https://forums.phpfreaks.com/topic/206160-string-to-date/ Share on other sites More sharing options...
Mchl Posted June 29, 2010 Share Posted June 29, 2010 $dateBefore = '29/06/2010'; $dateSplit = explode('/',$dateBefore); $dateAfter = $dateSplit[2]."-".$dateSplit[1]."-".$dateSplit[0]; You could also try strtotime and date although I'm not sure if strtotime() would parse this format. Link to comment https://forums.phpfreaks.com/topic/206160-string-to-date/#findComment-1078636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.