How to minus three years from the source date column

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dvpawankumar
Participant
Posts: 46
Joined: Fri Oct 06, 2006 6:36 am
Location: Tucson

How to minus three years from the source date column

Post by dvpawankumar »

Hi I need help on this.

I have a date column in source yyyy-mm-dd. I want to minus three years from this date for my requirement. Is there any function to do this.

ex: 2007-10-10

Minus three years means: 2004-10-10

How to get this.
Please heplp on this.

Thanks
Pawan
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you datatype is Date you can do a DateFromDaysSince() call, if the datatype is string you can also subract 3 years using a transform function such as

Code: Select all

In.Column[1,4]-3:In.Column[5,6]
The program will do in implicit conversion from string to integer and then back to string.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: How to minus three years from the source date column

Post by SURA »

dvpawankumar wrote:Hi I need help on this.

I have a date column in source yyyy-mm-dd. I want to minus three years from this date for my requirement. Is there any function to do this.

ex: 2007-10-10

Minus three years means: 2004-10-10

How to get this.
Please heplp on this.

Thanks
Pawan

Hi,

You can you like below.

DateFromDaysSince(-1095, InputColumn).

Regards,
Ram
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Actually that number isn't fixed, it depends upon whether or not there is a leap year involved.
turash
Premium Member
Premium Member
Posts: 51
Joined: Fri Apr 06, 2007 10:09 am
Location: Edison, NJ

Post by turash »

I agree with ArndW
ArndW wrote:Actually that number isn't fixed, it depends upon whether or
not there is a leap year involved.
Post Reply