IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want the difference between two dates


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Senior Member


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

PostPosted: Fri May 20, 2011 7:07 pm
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: 1281
Location: Belgium

PostPosted: Fri May 20, 2011 7:18 pm
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
Reply with quote

GuyC wrote:
DB2 Basics: Fun with Dates and Times

GuyC.. I have it bookmarked... Dick once shared link I think...
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
Search our Forums:

Back to Top