Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Want the difference between two dates

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

New User


Joined: 02 Sep 2010
Posts: 50
Location: Pune

PostPosted: Fri May 20, 2011 7:02 pm    Post subject: Want the difference between two dates
Reply with quote

I have a table called Table1 and it contains the DT_BIRTH column and the format is yyyy-mm-dd.Now I want to find out the age of the person as per the given unut date.

Example: person A has the value '1950-01-13' in the DT_BIRTH column and have to find out his age in yrs.


Can anyone please provide the query for this?
Back to top
View user's profile Send private message

Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Fri May 20, 2011 7:07 pm    Post subject:
Reply with quote

Just give it to you? How will you learn anything that way?

Can you do this in a regular language? If so, then you know the algorithm.

Can you look for DB2 functions that might extract the parts of a date, and then maybe use subtractions, and then see what happens, and then adjust your code till it works. That's how whoever gives you the code did it.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Fri May 20, 2011 7:18 pm    Post subject:
Reply with quote

DB2 Basics: Fun with Dates and Times
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 20, 2011 9:50 pm    Post subject:
Reply with quote

GuyC wrote:
DB2 Basics: Fun with Dates and Times

GuyC.. I have it bookmarked... Dick once shared link I think...
http://www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html
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
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us