Click to See Complete Forum and Search --> : Find day of week from date...


novemberGrey
08-29-2007, 10:23 PM
Hey If I give php the month and day, how can I get it to figure out which day of the week that date is?

NogDog
08-30-2007, 12:15 AM
You need to know (or assume) the year, too. :)

You could do something like:

$date = '2007/08/30';
$weekday = date('l', strtotime($date)); // note: first arg to date() is lower-case L

manojdashmca
09-08-2011, 05:41 AM
echo date('N', strtotime(date("Y-m-d"))); //for current date
echo date('N', strtotime("2010-08-09")); // for given date

NogDog
09-08-2011, 01:01 PM
echo date('N', strtotime(date("Y-m-d"))); //for current date
echo date('N', strtotime("2010-08-09")); // for given date

Hmm...did you really need to dig up a 4 years old thread to essentially repeat what I had posted way back then? :confused: