Page 1 of 1

Dateformat from Currentdate

Posted: Tue Jan 30, 2007 6:17 pm
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

Posted: Tue Jan 30, 2007 6:36 pm
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.

Posted: Tue Jan 30, 2007 7:03 pm
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

Posted: Tue Jan 30, 2007 7:05 pm
by ray.wurlod
What is the data type of current_dt?

Posted: Tue Jan 30, 2007 7:10 pm
by swades
Date Length 10

Thanks

Posted: Tue Jan 30, 2007 7:49 pm
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.