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.4 KiB
6.4 KiB
last_day
This function is used to return the last day of the month a date belongs to.
Similar function: lastday. The lastday function is used to return the last day of the month a date belongs to. The hour, minute, and second part is 00:00:00.
Syntax
last_day(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 DATE type, in the yyyy-mm-dd format.
Example Code
The value 2023-08-31 is returned.
select last_day('2023-08-15');
The value 2023-08-31 is returned.
select last_day('2023-08-10 10:54:00');
The value NULL is returned.
select last_day('20230810');
Parent topic: Date Functions