This function is used to return the week number (from 0 to 53) of a specified date.
weekofyear(string date)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
date |
Yes |
DATE or STRING |
Date that needs to be processed The following formats are supported:
|
The return value is of the INT type.
The value 33 is returned.
select weekofyear('2023-08-16 10:54:36');
The value NULL is returned.
select weekofyear('20230816');
The value NULL is returned.
select weekofyear(null);