roosterup
asked on
AS400 Convert text date field in mm/dd/yyyy format and store as a date field
I need to check a 10 digit text field for a valid date, then store the date in a date type field. what's the best why to do this in rpg?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
// To test for a future date:
if myDate > %date();
... do something here
endif;
// To test for a date prior to Jan 1, 1900, assuming DATFMT is set to ISO.
d riduculouslyOldDate...
d c const(d'1900-01-01')
if myDate < ridiculouslyOldDate;
... do something here
endif;
if myDate > %date();
... do something here
endif;
// To test for a date prior to Jan 1, 1900, assuming DATFMT is set to ISO.
d riduculouslyOldDate...
d c const(d'1900-01-01')
if myDate < ridiculouslyOldDate;
... do something here
endif;
How "well formed" are the dates? I.e., will they always be MM/DD/YYYY? Or is "1/7/2015" valid?
ASKER