How to convert system date to other format using RPGILE

140 pts.
Tags:
RPG
RPG/400
RPGILE
System date
please advice how can convert system date to other format using rpgile.
ASKED: February 4, 2009  11:20 AM
UPDATED: March 17, 2009  4:03 PM

Answer Wiki

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

Define a date field in a date format of your choice:

D Sysdate S D DatFmt(*USA) or

D SysDate S D DatFmt(*ISO)

The first format is MM/DD/YYYY, the second is YYYY-MM-DD.

Retrieve the system date:

C Move UDATE Sysdate

***********************************************************************

Actually UDATE is the JOB date, not the system date. You can get the system date by just
EVAL SysDate = %date()
As noted above, you can define the date field any way you want.

***********************************************************************

If you define a date field in D-specs tou can add an Inz(*Sys) after DatFmt and this will set the variable to the system date automatically at program startup. Likewise if you add an Inz(*Job) you get the job date or UDATE value.

Discuss This Question: 2  Replies

 
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
  • ReshmaG
    Hi U can also use %Date Buit in function. Thanks Reshma
    455 pointsBadges:
    report
  • RonKoontz
    Just do this in your D specs D SysDate S D datfmt(*iso) inz(*sys)
    1,780 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