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.5 KiB
6.5 KiB
lastday
This 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.
Similar function: last_day. The last_day function is used to return the last day of the month a date belongs to. The return value is in the yyyy-mm-dd format.
Syntax
lastday(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 STRING type, in the yyyy-mm-dd hh:mi:ss format.
Example Code
The value 2023-08-31 is returned.
select lastday('2023-08-10');
The value 2023-08-31 00:00:00 is returned.
select lastday ('2023-08-10 10:54:00');
The value NULL is returned.
select lastday (null);
Parent topic: Date Functions