System date and RPG/400

140 pts.
Tags:
OS/400 System Date
RPG
RPG/400
RPGILE
please advice me how to less 1 day from system date in rpgile. please send me the syntex.
ASKED: December 23, 2008  8:54 AM
UPDATED: December 24, 2008  3:12 PM

Answer Wiki

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

Hi, no problem.

H spec
datedit(*dmy)

D specs
Todaydate s d datfmt(*iso) inz
Yesterday s d datfmt(*iso) inz

then in *INZSR so it does it one time
*dmy move udate Todaydate
Todaydate subdur 1:*d Yesterday

Hope this helps.

Happy Christmas!

Best Regards

Graham

Discuss This Question: 3  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
  • Askt1
    thanks for update. i need to change all days,month and year. in the above you mentioned only days calculation. please advice me.
    140 pointsBadges:
    report
  • Cwc
    Or you could do this way - in fixed: EVAL TodayDate = %Date( ) EVAL Yesterday -= %Days(1) or free format: /Free TodayDate = %Date( ); Yesterday -= %Days(1); /End-Free Adding or subtracting a specified number of days to a date field will automatically adjust the month and year portion of the date as necessary, so you don't need to manipulate those. Thus, if today were 12/01/2008, subtracting 1 day results in 11/30/2008 (the format is controlled by the DATFMT keyword as in the original example). There are similar functions to add full months or years to a given date as well (%Months and %Years).
    4,290 pointsBadges:
    report
  • philpl1jb
    I think this should be in fixed: EVAL TodayDate = %Date( ) EVAL Yesterday = TodayDate -%Days(1) or free format: /Free TodayDate = %Date( ); Yesterday -= TodayDate - %Days(1); /End-Free "i need to change all days,month and year. in the above you mentioned only days calculation." As mentioned this has subtracted one day from the date type field To extract parts of the date from: http://www.itjungle.com/fhg/fhg051904-story01.html d myDate s d d days s 2s 0 d months s 2s 0 d years s 4s 0 d myString s 128a /free myDate = %Date( ); days = %subdt( myDate : *days ); months = %subdt( myDate : *months ); years = %subdt( myDate : *years ); /end-free The first response uses move and subdur these won't work in FREE and are I believe depricated. Phil
    48,575 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