First column:   year   month .   Number of months '>
Repeat day codes every '> columns.   Entry padding '>em.  

\n"; one_row(0,'y'); one_row(0,'m'); one_row(0,'h'," class='hlfln'"); $j=0; while (!isset($_g['mna'][-1][$j])) { $j++; } $ja=$j; while (true) { one_row($j); $j++; if (!isset($_g['mna'][-1][$j])) break; if ($_g['mna'][-1][$j]=="Mo") one_row(0,'h'," class='hlfln'"); } echo "\n\n"; echo "

\n". ($j-$ja) . " rows

\n". "Notes on curious non-bug on my home machine:
\n". "with date_default_timezone_set('UTC') - be patient
\n". "without that declaration
\n". "
\n"; echo "\n\n"; /* *1* How many rows? Theory says: the worst case is when you have Day 1 of one month falling on a Monday and Day 1 of another month which has 31 days falling on a Sunday. This require 37 rows to display. But back in 1995 I discovered that within any one year, if you put Sep 1 and Dec 1 (which always fall on the same day) at the top then it will always require only 36 rows */ # ---------------------------------------------- function one_row($j,$type="",$rclass="") { global $_g; echo "\n"; $col=0; while (true) { if (!($col % $_g['dr'])) echo "". (strlen($type) ? "" : $_g['mna'][-1][$j]); # Putting day codes at left and right looks quite pretty if ($col>=$_g['cc']) break; switch ($type) { case 'h': echo " "; break; case 'y': case 'm': echo "{$_g['mna'][$col][$type]}"; break; default: echo "". (isset($_g['mna'][$col][$j]) ? $_g['mna'][$col][$j] : ""); break; } $col++; } } # ---------------------------------------------- function show_bug() { if ($_REQUEST['bug']) date_default_timezone_set('UTC'); echo "First version of this showed funnies which took me ages to explain.
\n". "Solved it by a re-write of the code. Eventually realised that a quicker fix
\n". "would have been to declare date_default_timezone_set('UTC').

\n". "date_default_timezone_get() = ". date_default_timezone_get() ."

\n"; $spd=24*60*60; $ts=$spd/2; do { $strd=date("Y-M-d H:i:s",$ts); $hms2=substr($strd,12); if ($hms!=$hms2) { $hms =$hms2; echo "$strd". "
\n"; } $ts += $spd; } while ($ts<40*366*$spd); echo "\n\n"; exit; } ?>