Hello there,
Problem sketch: I have a database with a datetime field in it. When making a query I would like to output only the Hour & Minutes from that field. I've looked into it and I know that I should use date_format(), but I wouldn't have a clue as to where in my query I have to put it, nothing seems to work, any ideas? 😕
Thanks in advance.
Always look in the manual ...
SELECT DATE_FORMAT(NOW(), '%H:%i');
Date and time functions from mysql manual ...
Assume col_3 is the date/time field you want formatted:
SELECT `col_1`, `col_2`, DATE_FORMAT(`col_3`, '%H:%i') AS `hh_mm` FROM `table_name`
It seems I have to "select" all fields manually instead of using "*", anyway it's solved, thank you!