Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Difference between two dates in months

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mallikannasagaram

New User


Joined: 21 Feb 2006
Posts: 9
Location: india

PostPosted: Wed Sep 26, 2007 6:01 am    Post subject: Difference between two dates in months
Reply with quote

Hi,

I have a requirement in which i need to calculate the difference between two dates interms of months. Is there any possibility of finding the difference using DB2 query?Please let me know the query if there is a way of finding it.

Thanks,
Mallik
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Sep 26, 2007 6:45 am    Post subject:
Reply with quote

Hello,

Please post what you are using as input and how you want the output to be presented.
Back to top
View user's profile Send private message
mallikannasagaram

New User


Joined: 21 Feb 2006
Posts: 9
Location: india

PostPosted: Wed Sep 26, 2007 7:47 am    Post subject: Difference between two dates in months
Reply with quote

Hi,

The input is 2 different dates.

Here is the example for better understanding:
Date 1 = '2007-09-10'
Date 2 = '2006-12-22'

Then my output should be 9 months.


Thanks,
Mallik
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Sep 26, 2007 7:58 am    Post subject: Re: Difference between two dates in months
Reply with quote

mallikannasagaram wrote:
Hi,

The input is 2 different dates.

Here is the example for better understanding:
Date 1 = '2007-09-10'
Date 2 = '2006-12-22'

Then my output should be 9 months.


Thanks,
Mallik

The results of subtracting 2 date using DB2 is a signed 8 digit number (yyyymmdd), you can use that to calculate the number of months (yyyy * 12) + mm.
Back to top
View user's profile Send private message
mallikannasagaram

New User


Joined: 21 Feb 2006
Posts: 9
Location: india

PostPosted: Wed Sep 26, 2007 8:03 am    Post subject: Difference between two dates in months
Reply with quote

Hi Crag,

can you explain it with example?

Thanks,
Mallik
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us