[thelist] PHP date month list...?
Jens Brueckmann
jens.brueckmann at gmail.com
Thu Feb 15 05:34:36 CST 2007
Hi Tris,
> Why doesn't this 'function' output a list of months?
>
> for ($h = 1; $h <= 12; $h++) {
> $monthNo = date("m", $h);
> $monthName = date("M", $h);
> $flightdateListMonth .= "<option value=\"" . $monthNo . "\">" .
> $monthName . "</option>";
> }
>
> Hmmmm... I know I'm missing something obvious...
The date function requires a timestamp as second argument. This should work:
$monthNo = date("m", mktime(0, 0, 0, $h, 1, 0));
$monthName = date("M", mktime(0, 0, 0, $h, 1, 0));
Cheers,
jens
--
Jens Brueckmann
http://www.yalf.de
More information about the thelist
mailing list