In a code routine I receive strings like “04242009” and I need to convert it to April 24, 2009. I have played with several of the date conversion routines but I am getting no where. Help would be appreciated.

Thanks!
WBR

apply substring function

$day=substr("04242009", 0, 1);
$month=substr("04242009", 2, 3);
$year=substr("04242009", 4, 7);
$mydate=$year."-".$month."-".$day;

$converted_date=date($mydate,'F d, Y');

Thanks for pointing me in the right directions. I had to make some changes to your code and this is what I finally ended up with.
WBR

$chopDate =” 04242009";
        $month=substr($chopDate, 0, 2);
        $day=substr($chopDate, 2, 2);
        $year=substr($chopDate, 4, 7);
        $myDate=$month . "/" . $day . "/" . $year;
        $printDate = date("jS F, Y", strtotime ($myDate));
        print ("<h3> <center>$printDate </center></h3>");

it depends on your requirement. i didn't knew your requirement so i just gave an idea with dummy example.

Comments
Thanks for the help. I was looking in the wrong places in the PHP manual and your example was very helpfull. WBR
This question has already been answered. Start a new discussion instead.