Date Arithmetic inDatastage

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
amit_dwh
Participant
Posts: 22
Joined: Tue Apr 11, 2006 6:04 am

Date Arithmetic inDatastage

Post by amit_dwh »

Hi All

i have to subtract/add one/or more days from current date in transformer stage.
wht is the function or proper syntax to do this in datastage PX.

Thanks
Amit
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

You can use CurrentDate() function.
To add n days to current date, use CurrentDate() + n
To subtract n days from current date, use CurrentDate() - n

This fuction is even listed in Functions> Date & Time in derivation field in Transformer.
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

koolnitz wrote:You can use CurrentDate() function.
To add n days to current date, use CurrentDate() + n
To subtract n days from current date, use CurrentDate() - n

This fuction is even listed in Functions> Date & Time in derivation field in Transformer.
In the sameline, with a date in yyyy-mm-dd available, how can I get the day part of Julian Day [yyyyddd]. Any direction in this is appreciated. Thankz
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

[THREAD HIJACK!!!]

Please start a new thread for this question. It is not related to the topic of this thread.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mgendy
Premium Member
Premium Member
Posts: 44
Joined: Thu Sep 10, 2009 5:30 am
Contact:

Post by mgendy »

koolnitz wrote:You can use CurrentDate() function.
To add n days to current date, use CurrentDate() + n
To subtract n days from current date, use CurrentDate() - n

This fuction is even listed in Functions> Date & Time in derivation field in Transformer.
i try to use the above method , but it gives compile error

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

Kindly advice
Mohmmed Elgendy
Senior System Analyst
Data IntegrationTeam
Etisalat Egypt
+20 1118511161
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Prefer DateFromDaysSince() function.
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