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.9 KiB
5.9 KiB
year
This function is used to return the year of a specified date.
Syntax
year(string date)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
date |
Yes |
DATE or STRING |
Date that needs to be processed The following formats are supported:
|
Return Values
The return value is of the INT type.
Example Code
The value 2023 is returned.
select year('2023-08-16 10:54:36');
The value NULL is returned.
select year('23-01-01');
The value NULL is returned.
select year('2023/08/16');
The value NULL is returned.
select year(null);
Parent topic: Date Functions