× 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: Time Math in RPGLE
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Sun, 30 Jul 2000 02:44:37 -0500 (CDT)


Hi Arlene,

> I want to retrieve the hour and minutes between two dates & times, two
> timestamps so to speak.

This looks to be one of those questions which will get 50 replies, and
cause someone to say "look and see if there are already answers before
posting another one!"  So, for the record, as of the time of this writing,
nobody has replied.

Of course, by the time this message makes it to the list, there will
probably be 10 other people who have already answered your question,
so please be gentle with me :)

> 
> How do I define a timestamp in the D specs???
> 
> I have looked in the books and probably missed it, has anyone got any hints
> for me? 
> 
> Arlene Soderlund  
> AS/400        Project Leader/Sr. Programmer Analyst   

Timestamps are data type "Z".  As far as I know, there isn't a direct way 
to get "hours and minutes" between two timestamps, but you can get minutes
and do a simple DIV/MVR to conver it to hours and minutes.

Here's a quick example:

     D timestamp1      S               Z
     D timestamp2      S               Z
     D RawMinutes      S             10I 0
     D Hours           S             10I 0
     D Minutes         S             10I 0


     c     timestamp2    subdur    timestamp1    RawMinutes:*MN
     c     RawMinutes    div       60            Hours
     c                   mvr                     Minutes


HTH

      

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| 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:
Replies:

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.