× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Question on coding for TIME "calculations"
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 15 Apr 1999 12:01:36 -0500

Yes, its a little more complicated than simply using a SUBDUR.

However, consider this:  If you used SUBDUR to calculate hours, mins
and seconds all in one statement, what would the result field be?

It couldn't just be another "Time" field, because a time field must
always contain a valid time of day, and with subdur you can
(at least potentially) calculate negative numbers.

At any rate, doing what you want to do isnt particularly difficult.
heres a code sample:

     D T1              S               T
     D T2              S               T
     D TotSec          S             15  0
     D Hours           S              2  0
     D Mins            S              2  0
     D Secs            S              2  0

     C                   eval      T1 = T'08.00.00'
     C                   eval      T2 = T'16.30.00'
     C     T2            SUBDUR    T1            TotSec:*S
     C     TotSec        div       3600          Hours
     c                   mvr                     TotSec
     c     TotSec        div       60            Mins
     c                   mvr                     Secs

Hope that helps,
   Scott Klement
   Information Systems Manager
   Klement's Sausage Co, Inc.


Chuck Lewis <CLEWIS@IQUEST.NET> wrote:
> Hi Folks ]
>
> Maybe I'm making this harder than it needs to be (hope so ]) but I
>  need
> to be able to tell the "interval in time measurements of time (i.e.
>  8:00
> to 4:30 is 8 hours and 30 minutes in "human time" and appear
>  clueless...
>
> I've looked at the *SUBDR deal but it appears you have to do it for
> hours and minutes separately (?).
>
> Thanks in advance ]
>
> Chuck
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.