Page 1 of 1

How to minus three years from the source date column

Posted: Mon Oct 15, 2007 5:52 am
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

Posted: Mon Oct 15, 2007 6:03 am
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.

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

Posted: Mon Oct 15, 2007 6:14 am
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

Posted: Mon Oct 15, 2007 6:18 am
by ArndW
Actually that number isn't fixed, it depends upon whether or not there is a leap year involved.

Posted: Mon Oct 15, 2007 8:04 am
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.