How to reduce one year from current date

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
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

How to reduce one year from current date

Post 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
prabakaran.v
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

What does 'one year from now' mean in simple english?
...especially for '29-02-2008'?
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post 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?
prabakaran.v
shalini11
Participant
Posts: 74
Joined: Thu Jan 22, 2009 3:00 am

Post by shalini11 »

U can try this function;

YearFromDate(CurrentDate())-1
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post 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.
prabakaran.v
deepak.hsbc
Participant
Posts: 39
Joined: Sun Apr 15, 2007 11:30 pm

Post 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
"Books are as useful to a stupid person as a mirror is useful to a Blind person."
deepak.hsbc
Participant
Posts: 39
Joined: Sun Apr 15, 2007 11:30 pm

Post 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
"Books are as useful to a stupid person as a mirror is useful to a Blind person."
Scope
Premium Member
Premium Member
Posts: 63
Joined: Wed Jun 06, 2007 6:38 am
Location: Chennai

Post by Scope »

Try the below function

DateFromJulianDay(JulianDayFromDate(Link.Column) - 365)
Kumarez
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

Post by praburaj »

Thanks to all. My problem is resolved :lol:
prabakaran.v
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply