DateDifference
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 36
- Joined: Mon Mar 27, 2006 12:23 am
- Location: Chennai
DateDifference
is there any built in function to find the date difference of two DATE values
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard. :D
The Iconv() function itself does not calculate the date difference - it converts the date into DataStage internal format, which is the number of days from a particular day zero (31 Dec 1967). It follows that, if you subtract internal format dates, you get the difference in days.
The Iconv() function itself does not calculate the date difference - it converts the date into DataStage internal format, which is the number of days from a particular day zero (31 Dec 1967). It follows that, if you subtract internal format dates, you get the difference in days.
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.
Re: DateDifference
You can use the internal conversion asprasanna2100 wrote:is there any built in function to find the date difference of two DATE values
Iconv(date1,"D/DMY") - Iconv(date2,"D/DMY")
-
- Participant
- Posts: 36
- Joined: Mon Mar 27, 2006 12:23 am
- Location: Chennai
-
- Participant
- Posts: 36
- Joined: Mon Mar 27, 2006 12:23 am
- Location: Chennai
Considering gateleys observation about leap years, what you must do is first extract the year portion of each date, and then subtract.
Also, consider how your application treats fractional year differences; do you 'round-up' or 'round-down'?
As for the built-in date difference function, since DataStage keeps dates as an internal number type, it's already there ( the minus sign ).
Carter
Also, consider how your application treats fractional year differences; do you 'round-up' or 'round-down'?
As for the built-in date difference function, since DataStage keeps dates as an internal number type, it's already there ( the minus sign ).
Carter
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
YearsDiff = Int(DaysDiff / 365.249)
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: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
Hi,
Try following formula:
Oconv((Iconv(Arg1[1,10],"D/MDY") - Iconv(Arg2[1,10],"D/MDY")),"D2 Y") - 67
This may help you out:
Thanks,
Anupam
akarmarkar@smart-bridge.co.in
Try following formula:
Oconv((Iconv(Arg1[1,10],"D/MDY") - Iconv(Arg2[1,10],"D/MDY")),"D2 Y") - 67
This may help you out:
Thanks,
Anupam
akarmarkar@smart-bridge.co.in