month
The month function is used to return the month of the specified time, ranging from 1 to 12.
Syntax
month(string date)
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| date | Yes | DATE or STRING | The date to be processed. When date is of type STRING, it must contain at least yyyy-mm-dd and must not contain extra characters. Formats:
|
Return Values
Returns a value of type INT.
- If date is not of type DATE or STRING, an error is returned with the message "data type mismatch".
- If date is of type DATE or STRING but does not conform to the input format for date values, NULL is returned.
- If the date value is NULL, NULL is returned.
Example Code
- Example 1
select month('2023-08-10 10:54:00');Returns 8.
- Example 2
select month(null);
Returns NULL.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot