Page 1 of 1

How to reduce one year from current date

Posted: Thu Mar 12, 2009 2:49 am
by praburaj
Hi,

How to reduce one year from the current date. I already tried with DateFromDaysSince. But this logic does not work. Can anyone have other approach for this? Please help me to resolve this issue

Posted: Thu Mar 12, 2009 2:57 am
by Sainath.Srinivasan
What does 'one year from now' mean in simple english?
...especially for '29-02-2008'?

Posted: Thu Mar 12, 2009 3:25 am
by praburaj
I have to calculate the date of 365 days from today's date.
It means current date - 365. How to do this in data stage?

Posted: Thu Mar 12, 2009 3:52 am
by shalini11
U can try this function;

YearFromDate(CurrentDate())-1

Posted: Thu Mar 12, 2009 4:05 am
by praburaj
YearFromDate function is not working. When i compiled the job, i got error like this

Error in output column derivation expression for column Dat_BE_D in link LkOutTo_RM. Invalid conversion requested from a dfloat to a date.

Posted: Thu Mar 12, 2009 4:17 am
by deepak.hsbc
This transformationw will give you the desired result -

((YearFromDate(link.Column)-1) :'-': link.Column[6,2] :'-': link.Column[9,2])

Where link.Column is your date field coming as an input,So If you have link.Column =2009-03-12 Then the result will be 2008-03-12

Posted: Thu Mar 12, 2009 4:19 am
by deepak.hsbc
your error is because you are using input field as DATE and the conversion function is integer.YearFromDate return INTEGER.Change the datatype to CHAR 10

Posted: Thu Mar 12, 2009 4:44 am
by Scope
Try the below function

DateFromJulianDay(JulianDayFromDate(Link.Column) - 365)

Posted: Thu Mar 12, 2009 6:30 am
by praburaj
Thanks to all. My problem is resolved :lol:

Posted: Thu Mar 12, 2009 3:36 pm
by ray.wurlod
shalini11 wrote:U can try this function;

YearFromDate(CurrentDate())-1
U (one of our posters) did not ask the question.

The second person personal pronoun in English is spelled "you", not "u".

Please strive for a professional standard of written English on DSXchange. Among other things it makes things easier for those of us whose first language is not English.

Posted: Thu Mar 12, 2009 3:38 pm
by ray.wurlod
shalini11 wrote:U can try this function;

YearFromDate(CurrentDate())-1
U (one of our posters) did not ask the question.

The second person personal pronoun in English is spelled "you", not "u".

Please strive for a professional standard of written English on DSXchange. Among other things it makes things easier for those of us whose first language is not English.