Retrieve time from MySQL as HH:MM format
31,662
Solution 1
Check the DATE_FORMAT Function.
SELECT DATE_FORMAT(date_column, '%H:%i') FROM your_table
Solution 2
You will want to use DATE_FORMAT()
:
select date_format(yourDateColumn, '%h:%i') yourTime
from yourtable
Solution 3
SELECT DATE_FORMAT( NOW() , '%H:%i' ) AS time_column
Comments
-
ѕтƒ over 3 years
I used
DATETIME
datatype to store date and time in my Database. It saved date asYY-MM-DD HH:MM:SS (2012-11-06 10:45:48)
I can retrieve the time from database as
HH:MM:SS
format but I want to retrieve it inHH:MM
format.How can I do this?