note 19400 added to function.mktime
| From: | bob at bobarmadillo dot com | Date: | Tue, 26 Feb 2002 17:48:04 +0000 |
| Subject: | note 19400 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27069@lists.php.net to get a copy of this message | ||
one of the examples shows
mktime(0,0,0,12,32,1997)
which gives the first day of the next month - in this case, January 1, 1998.
but be careful! using 32 only works when the month has 31 days. For months with 30 days or
february you get the 2nd, 3rd or even 4th of the next month.
instead use:
mktime(0,0,0,$month+1,1,$year)
for the first day of the next month or
mktime(0,0,0,$month+1,0,$year)
for the last day of the current month.
Note: doesn't work right on years that have 13 months. ;-)
--
http://www.php.net/manual/en/function.mktime.php
http://master.php.net/manage/user-notes.php?action=edit+19400
http://master.php.net/manage/user-notes.php?action=delete+19400
http://master.php.net/manage/user-notes.php?action=reject+19400