Page 1 of 1

Date Arithmetic inDatastage

Posted: Mon Apr 24, 2006 3:47 am
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

Posted: Mon Apr 24, 2006 4:12 am
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.

Posted: Mon Apr 24, 2006 9:51 pm
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

Posted: Tue Apr 25, 2006 1:09 am
by ray.wurlod
[THREAD HIJACK!!!]

Please start a new thread for this question. It is not related to the topic of this thread.

Posted: Thu Dec 10, 2009 9:16 am
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

Posted: Thu Dec 10, 2009 4:24 pm
by ray.wurlod
Prefer DateFromDaysSince() function.