on 10-09-2008 7:10 PM
Hi experts,
I have an Age field coming from sender system.
I need to minus the age from current date and provide the output in form of date towards the target system.
PLS help me out..
The requirement was changed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
have a look at these
(How do I calculate the difference between two dates?)
http://joda-time.sourceforge.net/faq.html
Calculating the Difference Between Two Datetime Stamps
http://www.xmission.com/~goodhill/dates/deltaDates.html
Get difference in days
http://javaalmanac.com/egs/java.util/CompDates.html
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whenever you say Age,it will be in reference to some date(normally its current date).
The age which you are getting will also be in reference to some date.just get the date(and if not current date) subtract it from current date and get the result.
Thanx
Aamir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If i say i m 26 years old,that means i m 26 years old today(current date).if i say i was 25 years old.i need to specify when i was 25 years old(past date).It doesn't make sense that i say i was 25 years old but don't tell when i was 25 years old.
Age is always in reference to some specific date,you need to ask the sender system to tell you age is against which date and then use the UDF to subtract the past date from current date
>>The point is i am getting value in form of age....say 2yrs
This is not age,its a duration:)
Anyway,for your case,take the yyyy part of the date field and just subtract 2 from it.
The currentDate standard function will give the current date,change the format to yyyyMMdd(default is yyyy/MM/dd),then use substring function to take the first 4 digits and then subtract 2 from it.
Thanx
Aamir
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.