Page 1 of 1

Converting date formats

Posted: Tue Jul 19, 2005 12:21 am
by vmcburney
I have a date field coming in from DB2 in the format DD-MM-YYYY. I want to use it in a date function that needs it in the format YYYY-MM-DD. What's the easiest way to do the switch? Can do it in a modify stage or a transformer. Needs to handle one or two digit days and months.

Posted: Tue Jul 19, 2005 12:59 am
by ray.wurlod
Force the leading zeroes (Derivation) when extracting. Then you should be able to nest string_from_date in date_from_string in a Modify stage.

Posted: Tue Jul 19, 2005 3:12 pm
by pnchowdary
Hi Guys,

Can't we break the input date DD-MM-YYYY into three subparts i.e DD,MM,YYYY and then combine them together in the required order YYYY-MM-DD?

Thanks,
Naveen

Posted: Tue Jul 19, 2005 3:28 pm
by ray.wurlod
Only if its data type is string. If its data type is date, you must first convert to string (string_from_date in Modify stage would do). Only string data types (including ustring) support substring operations.

Posted: Tue Jul 19, 2005 3:31 pm
by pnchowdary
Hi Ray,

Thanks for the usefull information. Like always "Ray is the Best". :D

Thanks,
Naveen