How to get the previous date in Transformer

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
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

How to get the previous date in Transformer

Post by SURA »

Hi,

I need to get the previous date (Current date - 1) in stage variable. How to get it. Pls help me.

Sura
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Re: How to get the previous date in Transformer

Post by arnie_nits »

SURA wrote:Hi,

I need to get the previous date (Current date - 1) in stage variable. How to get it. Pls help me.

Sura
Can do this way....
Take two stage variables Stg1 and Stg2.....initialize as 9999-01-01 to both.

If Stg2<>Stg1 Then Stg2 Else Stg1-------->Stg1
and
Input latest date field --------------------------->Stg2

So in Stg1 You can will get the previous date and in Stg2 the latest date...
Regards
Arnie
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DateFromDaysSince() function should do it for you. The days offset can be negative.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: How to get the previous date in Transformer

Post by SURA »

SURA wrote:Hi,

I need to get the previous date (Current date - 1) in stage variable. How to get it. Pls help me.

Sura
I found the solutions.

DateFromJulianDay(JulianDayFromDate(Your_Date)-1).

Thanks for the efforts.

Sura
Post Reply