Teradata DATE Format

Teradata DATE format function converts the default date format as per the user requirements. For ANSI date format, by default Teradata follows DATE format as ‘YYYY-MM-DD’ and for IntegerDate Teradata follows date format as ‘YY/MM/DD’. 

The DATE format function can override the default date format of the Teradata system. Alternatively, your Teradata system administrator can change the default date format when the date form is set to IntegerDate types.

Changing the default DATE format involves changing the value of date elements in a custom specification for the DATE formatting file and using the tdlocaledef utility to convert the information into an internal form usuable by Teradata system.

Teradata DATE format syntax

The syntax of DATE format function in Teradata is as follows.

SELECT date_column FORMAT '<format_type>'
FROM TABLE;

Here,

  • FORMAT – The keyword for formatting the date value which should be followed by data column.
  • format_type – The reuired format you want to show in the resultset.

There are numerous DATE format available in Teradata. Some of are mentioned below.

Teradata DATE formats Example

FORMAT Phrase Result
FORMAT ‘YY/MM/DD’ 19/05/25
FORMAT ‘DD-MM-YY’ 28-01-2021
FORMAT ‘YYYY/MM/DD’ 28-01-2021
FORMAT ‘YYYY-MM-DD’ 28-01-2021
FORMAT ‘YYYY.DDD’ 1985.225
FORMAT ‘YYBDDD’ 85 225
FORMAT ‘DDBMMMBYYYY’ 12-Sep-85
FORMAT ‘MMMBDD,BYYYY’ Aug 12, 1999
FORMAT ‘YYYYBMMMBDD’ 1985 JUL 14
FORMAT ‘MMM’ Mar
FORMAT ‘EEE,BM4BDD,BYYYY’ Thu, September 12, 1985
FORMAT ‘E4,BMMMMBDD,BYYYY’ Thursday, September 12, 1985
FORMAT ‘E4BDDBM4BYYYY’ Jeudi 12 Septembre 1985
(Jeudi is French for Thursday and Septembre is French for September.)
FORMAT ‘999999’ 850912

Teradata TIME formats Example

FORMAT Phrase Result
FORMAT ‘HH:MIBT’ 01:20 PM
FORMAT ‘HH:MI’ 13:20
FORMAT ‘HH.MI.SS’ 13.20.53
FORMAT ‘HH:MI:SSBT’ 01:20:53 Nachm
(Nachm is German for PM.)
FORMAT ‘HH:MI:SSDS(F)’ 13:20:53.64
FORMAT ‘HH:MI:SSDS(F)Z’ 13:20:53.64+03:00
FORMAT ‘HHhMImSSs’ 13h20m53s

Teradata TIMESTAMP formats Example

FORMAT Phrase Result
FORMAT ‘MM/DD/YYBHH:MIBT’ 09/12/85 01:20 PM
FORMAT ‘MMMBDD,BYYBHH:MI:SS’ Sep 12, 85 13:20:53
FORMAT ‘E3,BM4BDD,BY4BHH:MI:SSDS(F)’ Thu, September 12, 1985 13:20:53.64
FORMAT ‘YYYY-MM-DDBHH:MI:SSDS(F)Z’ 1985-09-12 13:20:53.64+03:00