Page 1 of 1

RE:string to date

Posted: Tue Oct 31, 2006 1:51 am
by m_siddu2000
Iam converting a string to date in modify stage using the stringtodate function as follows:

C_date:date=date_from_string(date)[%dd:/:%mm:/:%yyyy]

Here C_date is the new column name.

and the error is coming as:

main_program: Error parsing modify adapter: Expected ';' or end, got: "["; input:
keep name,age,date
;
Full_Name=name
;
Age_N=age
;
C_date:date=date_from_string(date)[%dd:/:%mm:/:%yyyy]
;

could anyone rectify this solution?

Posted: Tue Oct 31, 2006 2:27 am
by balajisr
The specification should be of the form:

C_Date:date=date_from_string[dateformat](String)

Posted: Tue Oct 31, 2006 11:58 am
by kool78
try this in Modify stage

TargetDate:date=date_from_string["%yyyy%mm%dd"](SourceString)

assuming source string format as %yyyy%mm%dd...or u can change the format in specification according to the source string format.

Posted: Wed Nov 01, 2006 7:28 am
by ambasta
while deriving the column at transformer stage u can use stringtodate function and also specify ur desired format.

Posted: Wed Nov 01, 2006 8:13 am
by ray.wurlod
There is no need for concatenation operators in the date format string. "%yyyy/%mm/%dd" would suffice.