Age of a person
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 106
- Joined: Thu Jul 27, 2006 10:05 pm
- Location: Mumbai
Age of a person
hi all,
how to calculate the "Age of a person" or "difference b/w dates" using the datastage functions
ThanksinAdvance
Boppana Krishna
how to calculate the "Age of a person" or "difference b/w dates" using the datastage functions
ThanksinAdvance
Boppana Krishna
Re: Age of a person
Difference between dates can be found by converting the dates to Julianday and finding out the difference between them. But then finding out the age in years,months etc, will depend upon your business rules.boppanakrishna wrote:hi all,
how to calculate the "Age of a person" or "difference b/w dates" using the datastage functions
ThanksinAdvance
Boppana Krishna
-
- Premium Member
- Posts: 81
- Joined: Mon Nov 21, 2005 4:17 am
- Location: Sydney, Australia
- Contact:
Age Of a Person
Hi,
Did you try that by using Oconv((Iconv(Date1,"DMY")-Iconv(Date2,"DMY")),"DMY") ??
Regards,
Suresh N
Did you try that by using Oconv((Iconv(Date1,"DMY")-Iconv(Date2,"DMY")),"DMY") ??
Regards,
Suresh N
SURESH NARASIMHA
Suresh - He might have, but the PX compiler would have balked at that, even if the red highlighting in the transform stage wouldn't have given it away [but in Server that would have worked just fine!]
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
Re: Age of a person
Thats true. We can acheive the difference between the dates by using Julian Dates and by using substring functionality. But, getting the person age, it s completely depending upon your project requirement. Share your requirement, if you want some thoughts.ajith wrote:Difference between dates can be found by converting the dates to Julianday and finding out the difference between them. But then finding out the age in years,months etc, will depend upon your business rules.boppanakrishna wrote:hi all,
how to calculate the "Age of a person" or "difference b/w dates" using the datastage functions
ThanksinAdvance
Boppana Krishna
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
-
- Participant
- Posts: 106
- Joined: Thu Jul 27, 2006 10:05 pm
- Location: Mumbai
Re: Age of a person
Nageshsunkoji wrote:Thats true. We can acheive the difference between the dates by using Julian Dates and by using substring functionality. But, getting the person age, it s completely depending upon your project requirement. Share your requirement, if you want some thoughts.ajith wrote:Difference between dates can be found by converting the dates to Julianday and finding out the difference between them. But then finding out the age in years,months etc, will depend upon your business rules.boppanakrishna wrote:hi all,
how to calculate the "Age of a person" or "difference b/w dates" using the datastage functions
ThanksinAdvance
Boppana Krishna
yeah thanks for ur reply.. i want do develop the logic for the business logic" If incoming date is older than 5 years then reject"
My Approach--> first i have converted the incoming date into julian day and then i have done the difference between the julian days of incoming and the current Date..and then i have applied the function "DateFromJulianDay" but it showing the out out as "******"
can you suggest some thing ...when i have done the difference between the dates i goyt the julian day as 2994, then i have applied the DateFromJulianDay then i got the above output...
Re: Age of a person
boppanakrishna wrote:
yeah thanks for ur reply.. i want do develop the logic for the business logic" If incoming date is older than 5 years then reject"
My Approach--> first i have converted the incoming date into julian day and then i have done the difference between the julian days of incoming and the current Date..and then i have applied the function "DateFromJulianDay" but it showing the out out as "******"
can you suggest some thing ...when i have done the difference between the dates i goyt the julian day as 2994, then i have applied the DateFromJulianDay then i got the above output...
Hey after finding the difference compare it with 5 years worth days
that would do.
Get year, month and day from incoming date , concatenate year+5,Month and day convert it back to date, if that is less than current date, it is older than 5 years.
If Dt is the incoming date
Code: Select all
Stringtodate(YearFromDate(Dt)+5:MonthFromDate(Dt):MonthDayFromDate(Dt),'YYYYMMDD')
will give you the date after 5 years of incoming date. now you just have to compare it with current date, for that you can use DaysSinceFromDate function on this.
I think that would do
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Age
Use a stage variable svCurrentDate initialized to current_date().
Use DaysSinceFromDate() to get age in years. Divide by 365.249 to get age in years, then apply the floor() function to get age in completed years.
Date Difference
Use subtraction of Julian dates, as posted earlier.
Use a stage variable svCurrentDate initialized to current_date().
Use DaysSinceFromDate() to get age in years. Divide by 365.249 to get age in years, then apply the floor() function to get age in completed years.
Date Difference
Use subtraction of Julian dates, as posted earlier.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 106
- Joined: Thu Jul 27, 2006 10:05 pm
- Location: Mumbai
hi ray,ray.wurlod wrote:Age
Use a stage variable svCurrentDate initialized to current_date().
Use DaysSinceFromDate() to get age in years. Divide by 365.249 to get age in years, then apply the floor() function to g ...
Thanks for your reply ,i have tried with 365 before ..but what is the reason for ".249"i.e from (365.249)
Thanksalot
Boppana
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: