I'm working on a website that displays a year calendar of 2015. I use https://www.hscripts.com/scripts/php/yearly-calendar.php. You can see a demo on the page. On the demo you can see the week start on monday. I want to shift it the week start on monday. Does somebody know how I can alter the code below so the tablerow with days starts with monday and that the calender still counts correct.
<?php
$year = 2015;
echo "<table cellspacing=10 border=0>";
echo "<tr><td align=center colspan=3 class='topic'>$year Yearly Calendar</td></tr>";
for($ti=0;$ti<12;$ti++) {
$month = $ti+1;
if($ti%3==0) echo "<tr>";
echo "<td valign='top'>";
echo "<span class='monthnames'><b>".date( 'M', mktime(0, 0, 0, $month,1,0) )."</b></span>";
echo "<table border=0 class='tab'>";
echo "<tr class='daynames'><td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></tr>";
$timestamp = mktime(0,0,0,$month,1,$year);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) {
echo "<tr>\n";
}
if($i < $startday) echo "<td></td>\n";
else{
if($i - $startday + 1 == date('d') && date( 'F', mktime(0, 0, 0, $month,1,0) ) == date('F') && $year == date('Y'))
echo "<td align='center' valign='middle' class='curdate'>".($i - $startday + 1)."</td>\n";
else
echo "<td align='center' valign='middle'>".($i - $startday + 1)."</td>\n";
}
if(($i % 7) == 6 ) echo "</tr>\n";
}
echo "</table>";
echo "</td>";
if($ti!=0 && ($ti+1)%3==0) echo "</tr>";
}
echo "</table>";
Try this:
It will return: