TO_DATE Function | Data Types and Literals | Teradata Vantage - TO_DATE - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

Converts string_expr to a DATE data type.

TO_DATE does not convert data to any of the other datetime data types. Do not use the TO_DATE function with a DATE value for string_expr. The first two digits of the returned DATE value can differ from the original string_expr depending on format_arg or the default date format.

TO_DATE is an overloaded scalar function whose return value data type is DATE.

ANSI Compliance

This statement is a Teradata extension to the ANSI SQL:2011 standard.

Syntax

[TD_SYSFNLIB.] TO_BYTES ( string_expr, format_arg )

Syntax Elements

TD_SYSFNLIB.
Name of the database where the function is located.
string_expr

A character expression.

If the conversion fails, TO_DATE returns an error.

format_arg

A character argument.

format_arg is a data format specifying the format of string_expr.

If format_arg is omitted, the following default date format is used: YYYY-MM-DD

If format_arg is NULL, TO_DATE returns NULL.

If format_arg is not valid, an error is returned.

For more information, see format_arg Format Elements.