|
Hey Mike, There are a few ways to do this, one of which was already sent but I think only works on V5R2. Another way would be to parse the pieces into a data structure: d DSDateTxt ds d year 4 0 d dash1 1 inz( '-' ) d month 2 0 d dash2 1 inz( '-' ) d day 2 0 /free year = %subdt( DSDate : *y ); month = %subdt( DSDate : *m ); day = %subdt( DSDate : *d ); /end-free If you don't need to retain the zeros in month and day you could build one string: /free DSDateTxt = %char( %subdt( DSDate : *y ) ) + '-' + %char( %subdt( DSDate : *m ) ) + '-' + %char( %subdt( DSDate : *d ) ) + '-' ; /end-free This won't work if you need the zeros, and neither will %editc( ... : 'X' ) because the size of the return field from %subdt() is too big, that's why I prefer the DS approach. Speaking of which, do you guys have my free library? If you do, there are several procedures for formatting dates, one of which would do what you are trying to do: /free DSDateTxt = getDateStrISO( DSDate ); /end-free You could turn off the seperators or even change the seperator character if you want. Docs are here: http://www.rpgnext.com/docs/rnbdates.php#getDateStrISO You do need to be at V5R1. Download at http://www.rpgnext.com HTH, Joel http://www.rpgnext.com On Mon, 2003-10-06 at 16:29, Wills, Mike N. (TC) wrote: > Hey guys, I am trying to figure out how to move a date field to a text > field. Here is what works with fixed format. > > C Move DSDate DSDateTxt > > DSDate is defined as a date format (assumed *ISO) > DSDateTxt is a 10 char field. I [u]do[/u] want the '-' in the field. > > How would this be done? > > > Mike Wills > Lawson Programmer/Administrator > Taylor Corporation > Email: mnwills AT taylorcorpNOSPAM DOT com > AIM: iSeriesCodePoet > > _______________________________________________ > 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.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.