Gettting day of the week from day of the month

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Messian
Forum Newbie
Posts: 3
Joined: Wed Aug 20, 2003 1:47 pm

Gettting day of the week from day of the month

Post 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!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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'];
?>
Messian
Forum Newbie
Posts: 3
Joined: Wed Aug 20, 2003 1:47 pm

Post by Messian »

You da man! :D
Post Reply