Page 1 of 1

Posted: Wed Dec 15, 2010 11:01 am
by vinothkumar
Try this :
OConv(IConv(StageVar1[1,2]:'/':StageVar1[3,2]:'/':StageVar1[5,4], "D2/"),"D4/")

Where StageVar1 is your date '19991231'

Posted: Wed Dec 15, 2010 11:06 am
by vinothkumar
Sorry the date should be MMDDYYYY format :roll:

Posted: Wed Dec 15, 2010 11:26 am
by svhari76
My input date is 11302009
and tried your suggestion above and getting NULL as return

Posted: Wed Dec 15, 2010 12:38 pm
by vinothkumar
What's your target datatype. It should be a DATE.

Re: How to convert String MMDDYYYY to Db2 date MM/DD/YYYY

Posted: Wed Dec 15, 2010 12:43 pm
by gateleys
svhari76 wrote:Hi

How can i convert String MMDDYYYY to Db2 date MM/DD/YYYY ?

Eg: '11302009' to be 11/30/2009
Try-

Code: Select all

Oconv(Iconv(InLink.YourDate, "DMDY[2,2,4]"), "D/MDY[2,2,4]")

Posted: Wed Dec 15, 2010 12:57 pm
by chulett
I seem to recall the DB2 stage wanting dates in internal format... :?

Posted: Wed Dec 15, 2010 2:09 pm
by svhari76
I Tried this and still gets the NULL.

Oconv(Iconv(Input.LCL_DPTR_DTE, "DMDY[2,2,4]"), "D/MDY[2,2,4]")

Posted: Wed Dec 15, 2010 5:02 pm
by ray.wurlod
Leave off the Oconv() function. DB2 stage wants internal format.