MONTH
MONTH(date)
Section titled “MONTH(date)”- date: The “date” parameter represents the input date that needs to be evaluated in order to extract the month portion. This input date should adhere to the MySQL standard for dates (YYYY-MM-DD) or datetime (YYYY-MM-DD HH
Example
Section titled “Example”SELECT MONTH('2021-03-08');Output
Section titled “Output”3Explanation
Section titled “Explanation”The MONTH() function in MySQL retrieves the month from the specified date. In this example, it extracts the month from the timestamp ‘2021-03-08’, resulting in the output ‘3’.
MONTH(date)
Section titled “MONTH(date)”- date: This parameter represents the date value from which the month is to be extracted. It accepts a variety of formats, including date strings, date-type variables, or columns containing date data.
Example
Section titled “Example”SELECT MONTH('2022-06-30') AS Month;Output
Section titled “Output”Month6Explanation
Section titled “Explanation”In the example, the MONTH function extracts the month from the date (‘2022-06-30’), and the result is 6.
MONTH(date)
Section titled “MONTH(date)”- date: The input DATE or TIMESTAMP from which the month value is to be extracted. This function returns the month of the given date as a number. It ranges from 1 to 12 where 1 represents January and 12 represents December.
Example
Section titled “Example”SELECT MONTH(SYSDATE) FROM dual;Output
Section titled “Output”6Explanation
Section titled “Explanation”In Oracle SQL, the MONTH function extracts the month from the provided date. The above example returns the current month of the system’s date. In this case, ‘6’ represents June.