Page 1 of 1

Gettting day of the week from day of the month

Posted: Mon Aug 25, 2003 9:48 pm
by Messian
Hello,

I have a calendar, and the user can click on a day of the month, which is passed to a form. I need a way to get the day of the week (i.e. Fri) from the day of the month (i.e. 24th). I can get the current day of the week, but cant seem to find a function that allows me to correspond it to the day of the month.

Thanks!

Posted: Mon Aug 25, 2003 10:09 pm
by volka
getdate() and date() know about it

Code: Select all

<?php
$ts = mktime( 12, 0, 0 , 8 , 25, 2003);

echo date('F j, Y \w\a\s \a l (D)', $ts); // only the l and D parameter matter here

$d = getdate($ts);
echo ' / ', $d['weekday'], ' / ', $d['wday'];
?>

Posted: Tue Aug 26, 2003 9:40 pm
by Messian
You da man! :D