Hopefully someone can help me. I am using this calendar script and I’m trying to change the first day of the week to Monday, instead of Sunday. Thanks in advance for any help
[php]<?php
$CurDate = getdate(); //gets the server current date.
if (checkdate($HTTP_GET_VARS[‘month’],1,$HTTP_GET_VARS[‘year’]) == NULL)
{
$YearToShow = $CurDate[‘year’]; // $YearToShow = $CurDate[‘year’];
$MonthToShow = $CurDate[‘mon’]; // $MonthToShow = $CurDate[‘mon’];
}
else
{
if (checkdate($HTTP_GET_VARS[‘month’],1,$HTTP_GET_VARS[‘year’]) == false)
{
$YearToShow = $CurDate[‘year’];
$MonthToShow = $CurDate[‘mon’];
}
else
{
$YearToShow = $HTTP_GET_VARS[‘year’];
$MonthToShow = $HTTP_GET_VARS[‘month’];
if ( ($YearToShow < 1902) || ($YearToShow > 2037) )
{
$YearToShow = $CurDate[‘year’];
$MonthToShow = $CurDate[‘mon’];
}
}
}
// This checks to see if the current day will be displayed. If it is make the background a color.
if ( ($YearToShow == $CurDate[‘year’]) && ($MonthToShow == $CurDate[‘mon’]) ) { $DayToShow = $CurDate[‘mday’]; }
// This checks to see how many days are in the month in question.
$NumberOfDays = date(t,mktime(0,0,0,$MonthToShow+1,0,$YearToShow,-1));
// This section converts the month number to the month name.
$MonthNames = array(1=>‘January’,‘February’,‘March’,‘April’,‘May’,‘June’,‘July’,‘August’,‘September’,‘October’,‘November’,‘December’);
//$Years = array(‘1998’,‘1999’,‘2000’,‘2001’,‘2002’,‘2003’,‘2004’,‘2005’);
$Years = array($YearToShow-5,$YearToShow-4,$YearToShow-3,$YearToShow-2,$YearToShow-1,$YearToShow,$YearToShow+1,$YearToShow+2,$YearToShow+3,$YearToShow+4,$YearToShow+5);
// Sets up the href
if ($MonthToShow == 12)
{
$pmon = ($MonthToShow - 1);
$pyear = ($YearToShow);
$nmon = (1);
$nyear = ($YearToShow + 1);
}
else
{
if ($MonthToShow == 1)
{
$pmon = (12);
$pyear = ($YearToShow - 1);
$nmon = ($MonthToShow + 1);
$nyear = ($YearToShow);
}
else
{
$pmon = ($MonthToShow - 1);
$pyear = ($YearToShow);
$nmon = ($MonthToShow + 1);
$nyear = ($YearToShow);
}
}
echo <<<EOT
| ||||||
Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday |
",$offset); } // This section is to Allow the first day of the week to be sunday and also. // to make sure that the table prints out right. for ($i=1; $i <= $NumberOfDays; $i++) { $DayOfWeek = date(l,mktime(0,0,0,$MonthToShow,$i,$YearToShow)); if($DayOfWeek == 'Sunday') { print " | ||||||
$i | "; } else { print "$i | "; } if($DayOfWeek == 'Saturday') { print "\n",42-$NumberOfDays-$offset); } print "\n"; } elseif ( ($NumberOfDays != 28) || ($offset > 0) ) { if (35-$NumberOfDays-$offset > 0) { echo str_repeat(" | \n",35-$NumberOfDays-$offset); print "\n"; } } echo <<<EOT |