How do i split a date with php
Posted on 2007-12-05
Have field labeled surgery_date and is either in db as 2007-11-15 or 11/15/2007. It was entered both ways.
I want date as latter option for my output (ie. 11/15/2007)
If I do this for the former result will it keep my latter result intact as 11/15/2007 or will it take 11/15/2007 and make it null because it can't split it. What will happen to the output if I give it a value of 11/15/2007 and run it through the split below? Is there a way to split based on - and /
$surgery_date = $surgery_date;
list($month, $day, $year) = split('[/.-]', $surgery_date);
$surgery_date = "$month/$day/$year";