Currently I have a date format like this:
2012-07-24
I want to change it to this format:
July 07, 2012, Friday
Use date_create_from_format
, then use date_format
date_format(date_create_from_format("2012-07-24","Y-m-d"),"F D, Y, l")
you can use any of following method:
//1
echo date('F d, Y, l',strtotime('2012-07-24'));
//2
$date = date_create('2012-07-24');
echo date_format($date, 'F d, Y, l');
//3
$date = new DateTime('2012-07-24');
echo $date->format('F d, Y, l');
<?php
function changedateformat($date)
{
$date1=explode("-",$date);
$mktime=mktime(0,0,0,$date1[1],$date1[2],$date1[0]);
return date('F d, Y, l',$mktime);
}
$date1="2012-07-24";
echo changedateformat($date1);
?>