RE:string to date

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
m_siddu2000
Participant
Posts: 19
Joined: Tue Aug 01, 2006 1:37 am
Location: Hyderabad

RE:string to date

Post 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?
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

The specification should be of the form:

C_Date:date=date_from_string[dateformat](String)
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

Post 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.
"Attitude always and almost determines the altitude of your Life"
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

while deriving the column at transformer stage u can use stringtodate function and also specify ur desired format.
ambasta
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no need for concatenation operators in the date format string. "%yyyy/%mm/%dd" would suffice.
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