Date format conversion

Tools
Fan

Date format conversion

Pls help: Does anyone know how to convert the following date format into YYYY-MM-DD?

Eg.:
I need to convert 01-OCT-06 into 2006-10-01.

Im building an Insert statement on Mload script on Unix plataform.
1 REPLY
Teradata Employee

Re: Date format conversion

One possibility would be CAST(:fld AS DATE FORMAT 'DD-MMM-YY') but whether or not that does what you want depends on Century Break setting (those pesky two-digit years!). And since Century Break is a global setting for the entire machine...

You may need to insert the century digits ("20") before doing the CAST with FORMAT 'DD-MMM-YYYY'. That could be done prior to the MLOAD, on the client side during the MLOAD using a "field expression" in a .FIELD statement, or on the database side inside the CAST.