Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write a bulletproof date validation routine.
#51
Moneo: The date routine has one minor flaw, that other posters in the thread checked for.

I would check for Len(Z$) <> 8 first, because this would indicate a bad date.

One entry that passes your check is 200002228 even though it is 9 chars.

Otherwise, great job.

I would probably do this for the day and month check, it appears more logical to me, it took me a while to figure yours out.

Code:
IF ZMM < 1 OR ZMM > 12 THEN RETURN
IF ZDD < 1 OR ZDD > (ZMO(ZMM) - ((ZMM = 2) AND ISLEAPYEAR(ZYY))) THEN RETURN
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply


Messages In This Thread
My entry - by Meg - 10-11-2004, 09:03 PM
updated - by Meg - 10-12-2004, 08:01 PM
/nod - by Meg - 10-23-2004, 01:34 AM
Foo - by ToohTooh - 10-26-2004, 10:36 PM
Reply on Clarification Suggestion - by Neo - 10-26-2004, 11:37 PM
Re: Reply on Clarification Suggestion - by oracle - 10-27-2004, 02:00 AM
Hmm... - by ToohTooh - 10-27-2004, 02:12 PM
Re: Hmm... - by Neo - 10-27-2004, 10:12 PM
Thank you. - by ToohTooh - 11-01-2004, 04:54 PM
Write a bulletproof date validation routine. - by yetifoot - 07-27-2006, 10:52 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)