|
Posted by Rik on 01/26/07 18:29
Tom <tom@to.com> wrote:
> On Fri, 26 Jan 2007 09:48:37 +0000, raj wrote...
>>
>> Hi,
>>
>> I have 3 dropdowns. 1 for day, 1 for month and 1 for year.
>>
>> Does anyone have a script that will varify that the date chosen is a
>> real
>> calendar date (i.e takes into account different lengths of months and
>> also
>> leap years)?
>>
>> Thank you in advance,
>>
>> Kind regards,
>>
>> Raj (Newbie)
>>
>
>
> There are a few date settings that are always constant and a couple to
> watch out
> for. There are always 12 months in a year and a month has either 30, 31,
> or 28
> days except leap year where there's 29 in February. You can probably
> define some
> rules, such as which months have how many days. Months might be text
> (Jan.,
> January) or maybe numbers (01, 1, etc) so there's lots of things to
> watch out
> for. : )
Usually I don't bother, just intval() everything and make it a date,
mktime() will swallow faulty dates and change them, i.e. 31-04-2007 will
become 01-05-2007.
--
Rik Wasmus
Navigation:
[Reply to this message]
|