note 68851 added to function.date
| From: | micma18 at osu1 dot php dot net | Date: | Sun, 13 Aug 2006 11:06:09 +0000 |
| Subject: | note 68851 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115854@lists.php.net to get a copy of this message | ||
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!
----
Server IP: 194.239.128.50
Probable Submitter: 84.238.93.234
----
X-Spam-Status: Yes, hits=7.4 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HEAD_ILLEGAL_CHARS autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/68851
Del: integrated -- https://master.php.net/note/delete/68851/integrated
Del: useless -- https://master.php.net/note/delete/68851/useless
Del: bad code -- https://master.php.net/note/delete/68851/bad+code
Del: spam -- https://master.php.net/note/delete/68851/spam
Del: non-english -- https://master.php.net/note/delete/68851/non-english
Del: in docs -- https://master.php.net/note/delete/68851/in+docs
Del: other reasons-- https://master.php.net/note/delete/68851
Reject -- https://master.php.net/note/reject/68851
Search -- https://master.php.net/manage/user-notes.php