How do I select date and time without the seconds in mysql from a column with date value in a table ? \"YYYY-MM-DD HH:MM:SS\" should be \"YYYY-MM-DD HH:MM\"
SELECT DATE_FORMAT('2011-07-16 22:23:15', '%Y-%m-%d %H:%i');
SELECT DATE_FORMAT(`date`, '%Y-%m-%d %H:%i') AS `formatted_date` FROM `table`;
The proper solution is zero out seconds - and - preserve data type:
SELECT `datetime` - INTERVAL EXTRACT(SECOND FROM `datetime`) SECOND
FROM `some table`
If your datetime column contains microseconds then use this variant:
SELECT `datetime` - INTERVAL EXTRACT(SECOND_MICROSECOND FROM `datetime`) SECOND_MICROSECOND
FROM `some table`
SQL Fiddle
In theory, it should be faster than examples using date formatting functions.