Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199908

Re: [PHP3] Date Stuff From: Richard Lynch (rlynch <email protected>)
Date: 08/31/99

At 03:44 PM 8/31/99 -0500, you wrote:
>Is there something wrong with this snippit?
>
>for ($i = 1; $i <= 13; $i++) {
> echo "<option VALUE=$i>";
> echo date("M", mktime(0,0,0,$i));
> echo "</option>\n";
>}
>
>I'm using it in a select statement and here's the output:

The default for day/year would be today's, which is the 31st and 1999.

PHP then wraps your dates intelligently:
February 31, 1999 ==> Mar 3, 1999
April 31, 1999 ==> May 1, 1999
.
.
.

Simply specify a day of 1 to be sure it's valid.

PS You're lucky you wrote this today and not tomorrow. You wouldn't have
found the bug for about a month. Fun. :-)

><option VALUE=1>Jan</option>
><option VALUE=2>Mar</option>
><option VALUE=3>Mar</option>
><option VALUE=4>May</option>
><option VALUE=5>May</option>
><option VALUE=6>Jul</option>
><option VALUE=7>Jul</option>
><option VALUE=8>Aug</option>
><option VALUE=9>Oct</option>
><option VALUE=10>Oct</option>
><option VALUE=11>Dec</option>
><option VALUE=12>Dec</option>
><option VALUE=13>Jan</option>
>
>Any idea why the months are off?
>
>I believe that I am using PHP 3.08

phpinfo() will tell you for sure.

30 days hath September,
April, June, and November.
All the rest have 31,
except February, which has 28
(and 29 on Leap Years)

-- 
"TANSTAAFL"  Websites I have built:
CHaTMusic.com      EmphasisEntertainment.com     L-I-E.com
JadeMaze.com       CatCatalani.com               MGMH.com
AstraKelly.com     OlivierLedoux.com

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>