Example
Extract the last day of the month for the given date:
SELECT LAST_DAY("2017-06-20");
Definition and Usage
The LAST_DAY() function extracts the last day of the month for a given date. Continue reading MySQL LAST_DAY Function
Extract the last day of the month for the given date:
SELECT LAST_DAY("2017-06-20");
The LAST_DAY() function extracts the last day of the month for a given date. Continue reading MySQL LAST_DAY Function
Return the hour part of a datetime:
SELECT HOUR("2017-06-20 09:34:00");
The HOUR() function returns the hour part for a given date (from 0 to 838). Continue reading MySQL HOUR Function
Return a date from a numeric representation of the day:
SELECT FROM_DAYS(685467);
The FROM_DAYS() function returns a date from a numeric datevalue.
The FROM_DAYS() function is to be used only with dates within the Gregorian calendar.
Extract the month from a date:
SELECT EXTRACT(MONTH FROM "2017-06-15");
The EXTRACT() function extracts a part from a given date. Continue reading MySQL EXTRACT Function
Return the day of the year for a date:
SELECT DAYOFYEAR("2017-06-15");
The DAYOFYEAR() function returns the day of the year for a given date (a number from 1 to 366). Continue reading MySQL DAYOFYEAR Function
Return the weekday index for a date:
SELECT DAYOFWEEK("2017-06-15");
The DAYOFWEEK() function returns the weekday index for a given date (a number from 1 to 7).
Note: 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday. Continue reading MySQL DAYOFWEEK Function
Return the day of the month for a date:
SELECT DAYOFMONTH("2017-06-15");
The DAYOFMONTH() function returns the day of the month for a given date (a number from 1 to 31).
Return the weekday name for a date:
SELECT DAYNAME("2017-06-15");
The DAYNAME() function returns the weekday name for a given date. Continue reading MySQL DAYNAME Function
Return the day of the month for a date:
SELECT DAY("2017-06-15");
The DAY() function returns the day of the month for a given date (a number from 1 to 31).
Subtract 10 days from a date and return the date:
SELECT DATE_SUB("2017-06-15", INTERVAL 10 DAY);
The DATE_SUB() function subtracts a time/date interval from a date and then returns the date. Continue reading MySQL DATE_SUB Function