View Full Version : Number of days between two dates
wjminc
01-01-1995, 02:00 AM
I need to calculate the number of days between two dates. How is the best way to do this?I was told about QWCCVTDT API, where would I find information on using this. Or is there a better way? I am using RPG VI. Thanks for any help...... Willie
M.Martinez
02-02-1999, 02:54 PM
On Tuesday, February 02, 1999, 03:28 PM, William Moore wrote: I need to calculate the number of days between two dates. How is the best way to do this? There are a few ways to do this. I was told about QWCCVTDT API, where would I find information on using this. If you are interested in QWCCVTDT, I wrote an article in the Feb. 1998 issue of MC about it. The code is on the MC Website free of charge(written in RPG III and OPM COBOL). I used QWCCVTDT for date arithmetic before there were better solutions. It entailed converting the dates to a Julian dates and taking it from there. This gets messy when the dates are from different years, so I go with the easier ILE methods. Or is there a better way? I am using RPG VI. If you are using RPG IV, probably the easiest way is to use the Subtract Date Duration (SUBDUR) operation code. Using this command one can simply subtract one date from another and find the difference in terms of days. The other way is to use the CEEDAYS API. This is an ILE API, so you can use it with RPG IV. CEEDAYS calculates how many days any given date is since 1582 - I think that is where our current calender started. This date is called the lillian date. So you can get the lillian date for Date1, and the lillian date for Date2. When you have these numbers you just subtract the difference between them. This will be the number of days difference between the dates. Let me know if you want some examples.
David Abramowitz
02-02-1999, 05:35 PM
On Tuesday, February 02, 1999, 03:28 PM, William Moore wrote: I need to calculate the number of days between two dates. How is the best way to do this?<hr>Move your dates to date data types (defined in "D" specs), and use the SUBDUR opcode <c>DATE1 SUBDUR DATE2 RESULT:*D</c><hr> I am using RPG VI. <hr>Interesting!! :-) David Abramowitz
wjminc
02-03-1999, 08:33 AM
Mario, Could you give me some examples. I tried to find the SUBDUR in the IBM Book Manager/BookServer Library. But could not. I did find a reference to it in the ILE manual, but not knowing ILE it was Greek to me. I want to subtract a date in our master record from the current date to get a difference. It is one of these "I need it ASAP", but did not tell be untill the end of the day! I then found out the VP know about it for over a week. So any help would be appreciated... Willie
David Abramowitz
02-03-1999, 09:04 AM
On Wednesday, February 03, 1999, 09:33 AM, William Moore wrote: I tried to find the SUBDUR in the IBM Book Manager/BookServer Library. But could not. I did find a reference to it in the ILE manual, but not knowing ILE it was Greek to me. <hr> SUBDUR can be found in any ILE RPG Reference manual. David Abramowitz
trevor.lazarus@ssa.gov
02-04-1999, 09:12 AM
On Wednesday, February 03, 1999, 09:33 AM, William Moore wrote: I tried to find the SUBDUR in the IBM Book Manager/BookServer Library. But could not. I did find a reference to it in the ILE manual, but not knowing ILE it was Greek to me. <hr> Try this for an explanation of <a > href="http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/BOOKS/QBJAQE01/4.4.90">S UBDUR</a> You might also start with this link to <a > href="http://publib.boulder.ibm.com/pubs/html/as400/online/v4r1eng.htm">the books</a> Trevor Lazarus <a > href="http://www.compuware.com">Compuware</a>
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.