forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
5.6 KiB
5.6 KiB
to_date
This function is used to return the year, month, and day in a time.
Similar function: to_date1. The to_date1 function is used to convert a string in a specified format to a date value. The date format can be specified.
Syntax
to_date(string timestamp)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
timestamp |
Yes |
DATE STRING |
Time to be processed The following formats are supported:
|
Return Values
The return value is of the DATE type, in the yyyy-mm-dd format.
Example Code
The value 2023-08-16 is returned.
select to_date('2023-08-16 10:54:36');
The value NULL is returned.
select to_date(null);
Parent topic: Date Functions