Converting Date Formats
The conversion of dates takes place for any number of reasons. Conversions are mainly used to alter the data type of values defined as DATETIME values.
Typical reasons for date conversions are
To compare date values of different data types
To format a date value as a character string
To convert a character string into a date format
The ANSI CAST operator is used to convert data types into other data types. The basic syntax is |
CAST ( EXPRESSION AS NEW_DATA_TYPE )
Individual implementations of SQL may use another function instead of CAST. For example, in Oracle, the TO_DATE function is used to convert a character string to ...
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.