note 14257 modified in function.getdate by imajes

From: Date: Mon, 21 Oct 2002 21:47:54 +0000
Subject: note 14257 modified in function.getdate by imajes
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38382@lists.php.net to get a copy of this message
Tron@mailzone did something to produce a list box of the remaining months of the year. Thanks for that, was most useful. Here's a slight mod that shows 12 months from the current month. $today = getdate(); $thismonth = $today["mon"]; $nameofselectbox = "month"; print "<select name = \"$nameofselectbox\">\n"; for ($x=$thismonth;$x<$thismonth+12;$x++){ if($x<12) { $y=$x; } else { $y=$x-12; } print "<option value='" . date("m", mktime (0,0,0,$y,1,0)) . "'>" . date ("F", mktime(0,0,0,$y,1,0)) . "</option>\n"; } --was-- Tron@mailzone did something to produce a list box of the remaining months of the year. Thanks for that, was most useful.<p> Here's a slight mod that shows 12 months from the current month. <p> $today = getdate(); $thismonth = $today["mon"]; $nameofselectbox = "month"; print "<select name = \"$nameofselectbox\">\n"; for ($x=$thismonth;$x<$thismonth+12;$x++){ if($x<12) { $y=$x; } else { $y=$x-12; } print "<option value='" . date("m", mktime (0,0,0,$y,1,0)) . "'>" . date ("F", mktime(0,0,0,$y,1,0)) . "</option>\n"; } http://www.php.net/manual/en/function.getdate.php

« previous php.notes (#38382) next »