note 68851 deleted from function.date by nlopess
| From: | nlopess@php.net | Date: | Sun, 13 Aug 2006 11:20:49 +0000 |
| Subject: | note 68851 deleted from function.date by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115857@lists.php.net to get a copy of this message | ||
Note Submitter: micma18
----
To make a graphical layout of a calendar, running Monday to Sunday, you first need to make some
blank days, if the month isnât starting on a Monday. To find this number of blank days, you can
very simple just -1 from the date(w, $first_day_of_the_month) function to change it from a
Sunday-Saturday to Monday-Sunday format...
But thereâs a little tricky problem, if the first day of the month is a Sunday (native day 0 of
the month), the var is a value of -1, which could be a problem... (In my calendar anyway)
But a little if statement fixes this, very well:
if ($dayone < 0){
$dayone = $dayone + 7;
}
By adding 7 to -1 you get the six blank days, as you should :-) Know this isnât rocket science,
but I didnât spot this problem my self, until my boss called me up, and complained that October
1 wasnât a Monday...
Hope this could help with similar problems!