I'm trying to do something that seems possible, but I don't know how. I think I'm probably overcoding things, but that's the price for not knowing what I'm doing.
My goal is to expand a date stamp from a MySQL database (i.e. 04-07-2006) to a verbose string (i.e. Friday, April 7, 2006.) Is there a way to extract the Day Name and Month Name from just the date? Here is my code, which has a simple if statement to assign the Month name. I run an sql query to pull the variable $date from my database, then run this.
Any help on how to get the weekday name?
$daynumber=substr($date, -2, 2);
$yearnumber=substr($date, 0, 4);
$monthnumber=substr($date, -5, 2);
if ($monthnumber == "01") {$month = "January";}
if ($monthnumber == "02") {$month = "February";}
if ($monthnumber == "03") {$month = "March"; }
if ($monthnumber == "04") {$month = "April";}
if ($monthnumber == "05") {$month = "May";}
if ($monthnumber == "06") {$month = "June";}
if ($monthnumber == "07") {$month = "July";}
if ($monthnumber == "08") {$month = "August";}
if ($monthnumber == "09") {$month = "September";}
if ($monthnumber == "10") {$month = "October";}
if ($monthnumber == "11") {$month = "November";}
if ($monthnumber == "12") {$month = "December";}
echo $month ." ". $daynumber .", ". $yearnumber ;
Thanks,
Rob