On Mon, October 9, 2006 11:26 am, Ron Piggott (PHP) wrote:
> Is there a PHP function which verifies a valid date has been entered
> (YYYY-MM-DD)?  Ron

Note that both solutions so far are only partial solutions for most
real world scenarios.

For example:
0001-12-25
will pass both, and would appear to be Christmas #1 to the average
human eye, or a least readily identifiable in context as such.

Unfortunately, we've made rather of mess of dates and calendars over
the centuries, and 0001-12-25 is unlikely to be "correct" in any real
sense of the word, for most applications.

So you probably should include several more stringent checks suitable
to your web application.

Some examples:
Birth dates for living humans would be current date - 120 years range.
Credit card expirations should be current date + 10 years (I think...)
-- Actually, older dates are 'valid' but the credit card won't go
through anyway, so that might need 2 separate checks.

My point being that there really cannot be a single "valid" date check
because there's no way to be certain of the unique needs of your web
application.

The vagaries of date/time input are legion.

And don't even get me started on the goofball 15-minute offset
time-zone thing... :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to