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>
6.0 KiB
6.0 KiB
month
This function is used to return the month (from January to December) of a specified time.
Syntax
month(string date)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
date |
Yes |
DATE or STRING |
Date that needs to be processed If the value is of the STRING type, the value must contain at least yyyy-mm-dd and cannot contain redundant strings. The following formats are supported:
|
Return Values
The return value is of the INT type.
Example Code
The value 8 is returned.
select month('2023-08-10 10:54:00');
The value NULL is returned.
select month('20230810');
The value NULL is returned.
select month(null);
Parent topic: Date Functions