Usage of MySQL time conversion function
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.
mysql> select DAYOFWEEK(2007-10-31);
-> 4
WEEKDAY(date)
Returns the week index of date (0= Monday, 1 = Tuesday, ...). 6= Sunday).
mysql> select WEEKDAY('2007-10-31 13:05:00');
-> 2
mysql> select WEEKDAY('2007-10-31');
-> 2
DAYOFMONTH(date)
Returns the date in the month of date, in the range 1 through 31.
mysql> select DAYOFMONTH('2007-10-31');
-> 31
DAYOFYEAR(date)
Returns the number of days in a year, in the range of 1 to 366.
mysql> select DAYOFYEAR('2007-10-31');
-> 304
MONTH(date)
Returns the month of date, ranging from 1 to 12.
mysql> select MONTH('2007-10-31');
-> 10
DAYNAME(date)
Returns the name of the week of date.
mysql> select DAYNAME("2007-10-31");
-> 'Wednesday'
MONTHNAME(date)
Returns the month name of the date.
mysql> select MONTHNAME("2007-10-31");
-> 'October'
QUARTER(date)
Returns the quarter of date one year, ranging from 1 to 4.
mysql> select QUARTER('2007-10-31');
-> 4
WEEK(date)
WEEK(date,first)