First Day Of Month

A

Anonymous

Guest
I've got my calendar almost working. Nice little table format with the month and year on the top row. But I have one little problem....

I can't figure out how to use WDAY to get a number for the first day of the month. If I figure that out, 2 lines of code will complete my calendar.

So if I give you two variables...
$CurrentMonth = 6
$CurrentYear = 2004

How do I get the month's first day offest so I know in which column to put the "1" ? All of my other dates will fall into place. But nothing I've tried works for day 1.
 
After nearly 3 hours (remember, I'm just starting PHP), I came up with this.
Code:
<?php
$month = 6;
$year = 2004;
echo date("w", mktime(0, 0, 0, $month, 1, $year));
?>
[/code]
 
Back
Top