Page 1 of 1

Modify Stage-Type conversion from string to date

Posted: Thu Jul 06, 2006 12:30 am
by bala_135
Hi,

I need to convert a input field which is string to date.Eg(1/12/2006).
I am using the function date_from_string(input column)..I am getting a fatal error.But when i use a proper date like 2006/12/01 the function is working fine.How to solve this problem.

Regards,
Bala.

Posted: Thu Jul 06, 2006 12:55 am
by bchau
Try date_from_string[%dd-%mm-%yyyy](input column)

Posted: Thu Jul 06, 2006 1:53 am
by ray.wurlod
The format string may need to be "%mm/%dd/%yyyy" (note the use of "/" as the separator character, to match the data) and it may be necessary to guarantee the leading zero on the month and day components.

Posted: Thu Jul 06, 2006 2:06 am
by bchau
oops my bad ray, i missed that. Thank you for the correction ;)

Posted: Thu Jul 06, 2006 2:54 am
by bala_135
Hi Ray/bachu,

Thank you very much its working fine for the records which has got the exact format(%mm/%dd/%yyyy)but in my source i am having some records like 1/1/2006(month,date,year) here the month and date are not in the proper format so it issues a null in the target.

Regards,
Bala.

Posted: Thu Jul 06, 2006 5:47 am
by ray.wurlod
Read again "and it may be necessary to guarantee the leading zero on the month and day components". Use substring, concatenation and If constructs to get the format right.