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
 
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: 967
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: 1281
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 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
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm

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