Dateformat from Currentdate

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
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Dateformat from Currentdate

Post by swades »

Hi,
I search and read many Threads in this forum but I could not resolve my problem, Please help me....

I am using Currentdate as one of my column in Transformer which is in %yyyy-%mm-%dd format BUT I reqired in %mm/%dd/%yyyy format :

I am doing(in Transformaer) :
DateToString(CurrentDate(),"%mm%dd%yyyy")=string
StringToDate(StageVar1,"%mm%dd%yyyy")=current_dt

But that is not working pleases help me.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

First, CurrentDate() returns a date. There is no format.

When you use DateToString() you can specify a format.

Derivation expressions do not contain "=" characters to assign values. Try just

Code: Select all

 DateToString(CurrentDate(), "%mm/%dd/%yyyy")
as the derivation of the current_dt field/stage variable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Thanks Ray,
I did as you said, I am doing as under( I am not using '=')

DateToString(CurrentDate(),"%mm/%dd/%yyyy") = StageVar1
StringToDate(StageVar1,"%mm/%dd/%yyyy") = Current_dt

Current_dt is giving me 2007-01-30 !!! How this is coming. Please help me.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What is the data type of current_dt?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Date Length 10

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then don't apply a DateToString() function. Just assign CurrentDate() to this column.

You can change the display format (but not the storage format, which is "date") by selecting this row in the Columns grid, right click, choose Edit Row, and provide the date format string there.

If you want all dates processed by the stage to be mm/dd/yyyy format you can change the stage properties instead.
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