Teradata String To Date/Timestamp

Teradata String To Date/Timestamp

Teradata support ANSI Format to convert date/timestamp strings into date / timestamp datatypes. Various character and character strings (Metacharacters) are available in Teradata which can be used along with TO_DATE / TO_TIMESTAMP functions to convert strings into date/timestamp datatypes.

Below tables show most of the metacharacters that can used with TO_DATE / TO_TIMESTAMP function.

MetaCharacters

Description / Functionality

YYYY

Convert year in four digits(example: 1987)

YY

Convert year in two digits(example: 87)

MM

Convert month of the year in number format(example: 12)

MON

Convert month in 3 characters format(example: Jun)

MONTH

Convert full month name(example: June) format

DD

Convert day of the month in two digits(example: 30)

DDD

Convert day of the year(example: 276)

HH

Convert hour of the time in two digits(example: 17)

MI

Convert minutes of the time in two digits(example: 59)

SS

Convert seconds of the time in two digits(example: 58)

DY

Convert day of the week in 3 characters(example: Wed)

DAY

Convert full name of week day(example: Wednesday)

AM

Convert string timestamp with AM/PM format





All the below examples can be used convert strings into DATE/Timestamp datatypes