We help IT Professionals succeed at work.
Get Started

Find Date Difference in AS400 Query

valmatic
valmatic asked
on
1,760 Views
Last Modified: 2015-05-27
Hi.  I am comparing dates on a couple of different files and if those dates become out of balance by more than our 2 day buffer time, someone needs to react.  I was hoping to handle this with an IBM green screen query based report, which works for the most part but when the two dates split over a month end (April 30 and May 1) then the math gets skewed.  For example:  If DATEA = 115/05/01 and DATEB = 115/04/29 I would expect a 2 day difference but the result is actually 72.  If I create a field called NEWDATE that caculates [DATEA - 2]; the result is 1,150,499 instead of 1,150,429.   Screen Shot included  QryDate.pdf
I was wondering if there is still any way to calculate the difference between DATEA and DATEB in query?  
Dates are in CYYMMDD (115/04/23) format.

thanks
Comment
Watch Question
Expert for hire: IBM i, AIX, Linux, Windows, DB2, Performance, Security. EDI
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE