MySQL support datetime values into different formats using the DATE_FORMAT() function. This function accepts date or datetime values as a first parameter and returns to a specific format defined in the second parameter.
Define a DATETIME variable
SETÂ @date:='2014-06-16 14:12:49';
-- Display datetime values in YYYY-mm-dd format
SELECTÂ date_format(@date,'%Y-%m-%d')Â ASÂ formatted_date;
This would return: Monday, June 16, 2014
— Display datetime values in Month Year format
SELECTÂ date_format(@date,‘%M %Y’)Â Â ASÂ formatted_date;
This would return June 2014.
— Display datetime values in HH:MM:SS format
SELECTÂ date_format(@date,‘%T’)Â ASÂ formatted_date;
This would return 14:12:49.
-- Display datetime values as Full date format
SELECTÂ date_format(@date,'%W, %M %d,%Y %T')Â ASformatted_date;
This would return Monday, June 16,2014 14:12:49
Read the rest of the post here:Â http://blog.sqlauthority.com/2014/07/19/mysql-how-to-format-date-in-mysql-with-date_format/