note 37021 added to function.mktime

From: Date: Thu, 30 Oct 2003 23:55:34 +0000
Subject: note 37021 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-59548@lists.php.net to get a copy of this message
I created an array of months with the following code to populate a select box. On months that have 31 days my array would skip the next month as it contained 30 days. for ($i = 0; $i <= 11; $i++) { $myday = mktime (0,0,0,date("m")+$i,date("d"),0); $mymonth = date("F", $myday); $montharray[$i] = array($mymonth); } I changed the code to set the day of the month statically to the 15th. Now the array won't skip months. Hope this helps, anyone with the same problem. for ($i = 0; $i <= 11; $i++) { $myday = mktime (0,0,0,date("m")+$i,15,0); $mymonth = date("F", $myday); $montharray[$i] = array($mymonth); } ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37021 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37021&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37021&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59548) next »