to_date
The to_date function is used to return the year, month, and day from a time.
Similar function: to_date1. The to_date1 function converts a string in the specified format to a date value, supporting the specification of the target date format.
Syntax
to_date(string timestamp)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| timestamp | Yes | DATE or STRING | The time to be processed. Formats:
|
Return Values
Returns a date value of type DATE, in the format yyyy-mm-dd.
- If timestamp is not of type DATE or STRING, an error is returned with the message "data type mismatch".
- If timestamp is of type DATE or STRING but does not conform to the input format for date values, NULL is returned.
Example Code
Returns 2023-08-16.
select to_date('2023-08-16 10:54:36'); Returns NULL.
select to_date(null);
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot