get month from date mysql code example

Example 1: mysql extract month

SELECT EXTRACT(MONTH FROM '2020-07-05')

Example 2: mysql select month and year

SELECT DATE_FORMAT(test_date,'%Y%m') AS date FROM test_table;

Example 3: mysql extract month from date

SELECT MONTH(field_name) as month FROM yourtable

Example 4: get month from database php

echo 'Day' . date('d', strtotime($row['Date']));
echo 'Month' . date('m', strtotime($row['Date']));
echo 'Year' . date('Y', strtotime($row['Date']));

Example 5: month mysql

SELECT MONTH("2017-06-15");

Tags:

Php Example