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

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

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.