(AS/400 – RPG(ILE)) Date-Conversion

560 pts.
Tags:
AS/400 development
Date conversion
RPG/400
RPGILE
Date-Conversion --------------------- I have a date in 7-digit format in '1YYMMDD' format. e.g 1071231 for representing 31st of December 2007.(where '107' represents 2007; 12 represents December & 31 represents 31st Day of the month). Now i need to convert this into '31/12/2007' (European format). Now my question is: Is there any direct function/method/facility available in RPGILE to get this? - - OR - - Do we need to create a "data structure"; break this date into individual components & Make it '2000' or '1900' based on the YEAR( I already did this. But i want to know whether there is any function/method readily available in RPG/ILE Thanks, Svanky
ASKED: February 9, 2009  11:22 AM
UPDATED: February 11, 2009  2:20 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

use cvtdat convert date to convert date in any format like ddmmyy mmddyy yymmdd and you can even add separators in it

///////////////////////////////////////////////////////////
Sorry this got wiped by a later answer so I’m re-entering it.

dateOut 8S 0 DDMMCCYY
datein 7S 0 CYYMMDD

eval dateOut = %UNS(%CHAR(%date(DATEIN : *cymd )
: *eur0))

Phil
//////////////////////////////////////////////////////////

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • graybeard52
    If you define dateout as a date field with DATFMT(*EUR), the conversion works, even to adding in the seperators. dateout = %date(numeric:*CYMD)
    3,115 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following