|
Now you guys got me playing with converting dates... Can anybody tell me why this gives me a "The factor 2 entry of charDate is too small to contain a timestamp" (compile) error? The manual says I can move a character date to a timestamp and I have the (*Zero) to indicate that there are no separators... d charDate s 8 Inz('19570630') d timeStamp s z Inz c *iso0 move charDate timeStamp c eval *inlr=*on -----Original Message----- From: Scott Klement [mailto:klemscot@klements.com] Sent: Tuesday, May 21, 2002 8:59 AM To: 'rpg400-l@midrange.com' Subject: RE: Calculating Duration in days/hours from timestamp field It sounds like you got it working, already. Here's a sample of doing the same thing with timestamps instead of date/time fields. Someone might find it useful someday, who knows? :) D timethen S Z inz(z'2002-02-27-16.30.27') D timenow S Z inz(*sys) D totalmin S 10i 0 D min S 10i 0 D hrs S 10i 0 c timenow subdur timethen totalmin:*mn c eval hrs = %div(totalmin:60) c eval min = %rem(totalmin:60) c dump c eval *inlr = *on On Tue, 21 May 2002, Dean Bathke wrote: > Thanks Martin > > I couldnt find much info on %DIFF although it DOES roll off the tongue > rather nicely, LOL > In any case I found this little sample and modified it to work as I needed > it to. > If you have any info or examples you want to share concerning the %DIFF BIF, > Id love to see it.. > Thanks > > > Dtimenow S T inz(*sys) > Dtimethen s t inz(T'16.30.27') > Ddatenow s d inz(*sys) > Ddatethen s d inz(D'2002-02-27') > Dmin s 10i 0 > Dtotalmin s 10i 0 > Ddays s 10i 0 > Dhrs s 10i 0 > C timenow subdur timethen min:*mn > C datenow subdur datethen days:*d > C eval totalmin = days * 1440 + min > C eval hrs = %div(totalmin:60) > C eval min = %rem(totalmin:60) > C dump > C eval *inlr = *on > _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com 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.