Mike, this comes up from time to time (just a few days ago, as I
recall), and the consensus is that a proc like this will never operate
reliably....
At least you seem to be requiring an 8 digit numeric. That eliminates
one-third of the problem (identifying the year portion), but still
leaves month and day elements unaccounted for...
Take this numeric date value and tell me what format it is: 08082008
It could be month-day-year, or day-month-year.
Using character separators *might* help you out, if your users are using
the right separators for the format they're entering... 08.08.2008 and
08/08/2008 should map to *EUR and *USA respectively, but can you count
on your users to know the distinction?
Eric DeLong
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mike
Sent: Thursday, October 23, 2008 9:07 AM
To: RPG programming on the AS400 / iSeries
Subject: Figuring out Date Format
Is there an API or a BIF that I can pass in an unknown date format and
get back a date format I can expect? I am seeing how difficult it might
be to allow a user to enter in a date how they want. (ex. '01012008'
'01/01/2008'
'20080101') and return *ISO or something else. I could write a
subprocedure, but I thought I would see if there is something out there
that would either make the code easier or eliminate my needing it.
--
Mike Wills
Midrange Programmer/Analyst
Sick of corporate radio and hungry for something new?
http://thenextgenerationofradio.com
Stalking me?
http://twitter.com/MikeWills |
http://friendfeed.com/mikewills
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.