|
Brute force date validation isn't too hard unless you want to make it generic. Then it takes a lot of fooling around to make a standardized version to run the validation code on. Let's assume a numeric date in ISO format: Use a data structure to separate year month, and day. Validate month and day of month with a dim 12 array indexed by month number with each cell containing the number of days in the month. Throw out zero year, month, or day and month > 12 before the array lookup. Then you have leap year. IIRC the rule is year divisible by 4 but not by 400. You only need to check this for 2/29. If you need to make sure years are in a "reasonable" range you can check for that too. As everyone else has said, RPGIV makes date handling so much easier that it alone is more than worth the price of admission. <><><>-----Original Message----- <><><>From: rpg400-l-bounces@xxxxxxxxxxxx <><><>[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Shijith_Chand <><><>Sent: Thursday, September 08, 2005 7:51 AM <><><>To: rpg400-l@xxxxxxxxxxxx <><><>Subject: Re: How to check valid date <><><> <><><> <><><> <><><>I Guess TEST op-code works only in RPG IV .For Testing a <><><>date in RPG 400 I think we need to get down to the crude <><><>method Or Is there any other way? <><><> ***************************** NOTICE: All e-mail sent to or from this e-mail address will be received or otherwise recorded by The Sharper Image corporate e-mail system and is subject to archival, monitoring, and review by and/or disclosure to Sharper Image security and other management. This message is intended only for the use of the addressee and may contain information that is privileged and confidential. The contents of this message may contain personal views which are not the views of The Sharper Image. If you are not the intended recipient, dissemination of this communication is prohibited. *****************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.