Page 1 of 1

How to change Date format change from YYYY-MM-DD to YY-MM-DD

Posted: Fri Apr 02, 2004 9:49 am
by rkumar28
Hi,

I am new to DataStage. I am looking for an available function to change the date format from YYYY-MM-DD to YY-MM-DD. Actually my source flat file has the YYYY-MM-DD format but my target teradata table has a column that has Date datatype and is defined to take YY-MM-DD date format.

Thanks

Posted: Fri Apr 02, 2004 11:03 am
by tonystark622
Use ICONV and OCONV to convert it to the new format. SOmething like:

OCONV(ICONV(DateValue, "D-YMD[4,2,2]"), "D-YMD[2,2,2]")

Re: How to change Date format change from YYYY-MM-DD to YY-M

Posted: Fri Apr 02, 2004 2:20 pm
by jseclen
Hi, the other way is use substrings

Your format --> 'YYYY-MM-DD'

Value = DateField[2,8]

Example:

'1999-04-02' applying DateField[2,8]

Value='99-04-02'

Saludos.

:lol:

Posted: Fri Apr 02, 2004 7:48 pm
by ray.wurlod
Or you can even use the "rightmost substring" to return the rightmost eight characters (remember that there are no data types within DataStage). There are two syntaxes:

Code: Select all

DateField[8]
Right(DateField,8)