|
I don't get the relationship between "36:05" and "1-12:05". Is that supposed to be 1 day, 12 hours, 5 minutes? In the RPG xTools, there are date difference procedures. They return a DS like this: D DateDiff_T DS D QUALIFIED D ddYears 10I 0 D ddMonths 10I 0 D ddDays 10I 0 D ddHours 10I 0 D ddMinutes 10I 0 D ddSeconds 10I 0 D ddMSeconds 10I 0 You'd call it like this: D MyDiff DS LikeDS(DateDiff_T) C callp dtsDiff(myDiff : dts1 : dts2) You can't do this with a Z (timestamp) data type for the very reasons you're discovering now. So you'll need to use xTools or reinvent the wheel. I seem to recall the xTools procedure took about 3 or 4 hours of clock time from start to production packaging to get it working in 100% of the situations. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx Sent: Monday, January 31, 2005 11:53 AM To: RPG programming on the AS400 / iSeries Subject: Re: Converting minutes to hours/minutes I just screwed up. I meant if the hours exceeded a day. Like 36 hours and 5 minutes. How would one want this formatted? 36:05 or 1-12:05 Since there's no 'zero' date, this won't format nice using my technique. Then you start getting a huge select statement. Select; When %diff(timestamp2:timestamp1:*years)>0; // Include year When %diff(timestamp2:timestamp1:*months)>0; ... Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com RPower@xxxxxxxxxx Sent by: rpg400-l-bounces+rob=dekko.com@xxxxxxxxxxxx 01/31/2005 08:48 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Converting minutes to hours/minutes 245 / 60 = 4 with Remainder of 5 mins. Thus 4 hours and 5 minutes. That exceeds an hour doesn't it? Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill rob@xxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 31/01/2005 01:33 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Converting minutes to hours/minutes I like my solution better. What happens if the duration exceeds an hour? But, in some cases, your solution would work. D mytime s t timfmt(*hms) D DspChar s 5a /free clear mytime; mytime += %minutes(175); DspChar = %subst(%char(mytime):1:5); dsply mytime; dsply DspChar; Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 01/31/2005 11:50 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Converting minutes to hours/minutes > C timestamp2 subdur timestamp1 mins:*mn 5 0 > > Now I need to convert the 'mins' to hour/minute. I checked the RPG ILE > manual and only can find the *mn or *h. Perhaps I'm not understanding the situation. Wouldn't converting it to hours/minutes be as simple as dividing it by 60 and taking the remainder? -- 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. -- 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. -- 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. -- 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.