Note that there are some explanatory texts on larger screens.

plurals
  1. POlinear calendar first day is Monday, change to Sunday
    primarykey
    data
    text
    <p>how can i change the first day in the first column of weeks into Sunday.</p> <p>here's the code i got from a website, and I've been trying to change the position of the days but still it displays the first day of the week as Monday. how can i change it to Sunday, thanks in advance :)</p> <pre><code>&lt;?php $dDaysOnPage = 37; $dDay = 1; if (isset($_REQUEST['year'])) { if ($_REQUEST['year'] &lt;&gt; "") { $dYear = $_REQUEST['year']; } else { $dYear = date("Y"); } } else { $_REQUEST['year'] = date("Y"); $dYear = $_REQUEST['year']; } ?&gt; &lt;table style="margin-left:-80px;" class="table table-bordered"&gt; &lt;tr class="blue"&gt; &lt;td&gt;&lt;?php echo $dYear; ?&gt;&lt;/td&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;!--i change this to Sunday--&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;th&gt;We&lt;/th&gt; &lt;th&gt;Th&lt;/th&gt; &lt;th&gt;Fr&lt;/th&gt; &lt;th&gt;Sa&lt;/th&gt; &lt;th&gt;Su&lt;/th&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;th&gt;We&lt;/th&gt; &lt;th&gt;Th&lt;/th&gt; &lt;th&gt;Fr&lt;/th&gt; &lt;th&gt;Sa&lt;/th&gt; &lt;th&gt;Su&lt;/th&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;th&gt;We&lt;/th&gt; &lt;th&gt;Th&lt;/th&gt; &lt;th&gt;Fr&lt;/th&gt; &lt;th&gt;Sa&lt;/th&gt; &lt;th&gt;Su&lt;/th&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;th&gt;We&lt;/th&gt; &lt;th&gt;Th&lt;/th&gt; &lt;th&gt;Fr&lt;/th&gt; &lt;th&gt;Sa&lt;/th&gt; &lt;th&gt;Su&lt;/th&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;th&gt;We&lt;/th&gt; &lt;th&gt;Th&lt;/th&gt; &lt;th&gt;Fr&lt;/th&gt; &lt;th&gt;Sa&lt;/th&gt; &lt;th&gt;Su&lt;/th&gt; &lt;th&gt;Mo&lt;/th&gt; &lt;th&gt;Tu&lt;/th&gt; &lt;/tr&gt; &lt;?php function FriendlyDayOfWeek($dayNum) { // converts the sunday to 7 // This function can be removed in php 5 by - date("N"), // just remove function calls below and replace by swapping date("w" for date("N" if ($dayNum == 0){ return 7; } else { return $dayNum; } } function InsertBlankTd($numberOfTdsToAdd) { for($i=1;$i&lt;=$numberOfTdsToAdd;$i++) { $tdString .= "&lt;td&gt;&lt;/td&gt;"; } return $tdString; } for ($mC=1;$mC&lt;=12;$mC++) { $currentDT = mktime(0,0,0,$mC,$dDay,$dYear); echo "&lt;tr&gt;&lt;td class='monthName'&gt;&lt;div&gt;".date("M",$currentDT)."&lt;/div&gt;&lt;/td&gt;"; $daysInMonth = date("t",$currentDT); echo InsertBlankTd(FriendlyDayOfWeek(date("w",$currentDT))-1); for ($i=1;$i&lt;=$daysInMonth;$i++) { $exactDT = mktime(0,0,0,$mC,$i,$dYear); if ($i==date("d")&amp;&amp;date("m",$currentDT)==date("m")) { $class="currentDay"; } else { $class = ""; } echo "&lt;td class='".$class." days day".FriendlyDayOfWeek(date("w",$exactDT))."'&gt;".$i."&lt;/td&gt;"; } echo InsertBlankTd($dDaysOnPage - $daysInMonth - FriendlyDayOfWeek(date("w",$currentDT))+1); echo "&lt;/tr&gt;"; } ?&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload