Reputation: 99
Hello i've been working on how to get yesterday date in DataStage?
CurrentDate()-1
When i compile the job, it gave me an error. So how should i do to get the yesterday date? btw that code i'm doing it in the Transformer stage
Upvotes: 0
Views: 9728
Reputation: 841
In a parallel Transformer stage, I'd use DateFromDaysSince() function. Use current date function as the base, and -1 as the offset value.
Upvotes: 0
Reputation: 3995
Assuming you are using the parallel engine in DataStage - this could be a solution
DateOffsetByComponents(CurrentDate(), 0, 0, -1)
As the last parameter is the day part and -1 would substract a day
Upvotes: 2
Reputation: 489
Convert the date into a date type, then you can add or subtract days.
You can use IConv to convert a string into a datastage internal date format. Then you can perform addition/subtraction on the date. Then use OConv to convert the variable back to string format.
If this is done in a transformer stage, you need to do this all in one statement:
OConv(Iconv(VDate ,"D/YMD[4,2,2]") - 1), "D/YMD[4,2,2]")
Hope this helps.
Upvotes: 1