Date conversion

2505 pts.
Tags:
AS/400
AS/400 Fields
I have a character field wISODate of length 8A. It holds value in the form of yyyymmdd. I want to convert this to an ISO date field. Decclaration D wDAte S D D wISODate S 8A Assume wISODate has value '20121001' *YMD0 Move wISODate wDAte Any other better method is there instead of using Move?

Software/Hardware used:
AS400

Answer Wiki

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

Discuss This Question: 8  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
  • TomLiotta
    Simplest might be [ eval wDAte = %date(wISODate) ]. -- Tom
    125,585 pointsBadges:
    report
  • RamvishakRamesh
    Great, now I need to compare the dates. I have a wDateA field of 6A which contains date data stored as ddmmyy and wDate1 which is of 8A contains date data as yyyymmdd and wDate2 which is also of 8A and contains date data as yyyymmdd. Now I want to know whether the 6A date field(wDateA ) is between wDate1 and wDate2 I tried like this but it is crashing with 'receiver too small' error. %Date(wDateA:*DMY0) %Date(wDate2:*Ymd)
    2,505 pointsBadges:
    report
  • TomLiotta
    Can you format the code better? I can't quite tell what it is saying. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    It seams like this would work. Unless I'm confused again.... . Create all three fields wDate1, wDate2, wDateA as date types . eval wDAte1 = %date(wISODate : *iso0) eval wDAte2 = %date(wISODate2 : *iso0) eval wDAteA = %date(wISODateA : *mdy0 ) If wDateA >= wDate1 and wDateA <= wDate2 . . But I would put it in a monitor block because if any of the character fields don't contain a valid date the function will throw an error. . Phil
    49,960 pointsBadges:
    report
  • BigKat
    monitor; If %date(wISODateA : *dmy0 )>= %date(wISODate : *iso0)and %date(wISODateA : *dmy0 )<= %date(wISODate2 : *iso0); ... endif; on-error *all; ... endif;
    8,210 pointsBadges:
    report
  • BigKat
    doh! the last "endif" should be "endmon"
    8,210 pointsBadges:
    report
  • philpl1jb
    BigKat That's cool! .. and change my *mdy0 to *dmy0 ... In the discreate conversion each step could be monitored seperately so that we would know which date was invalid... but I'm sure the OP never has a bad date. Phil
    49,960 pointsBadges:
    report
  • BigKat
    … In the discrete conversion each step could be monitored separately so that we would know which date was invalid… that's true philpl1jb, if it was important to know which one was in error, I would have to either determine it in the monitor or do a dump(a) to get a listing of them all or something
    8,210 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