So folks.
I need to know if I'm going to just send the hours H: i: s from the NOW()
function in the database, or send the NOW()
complete and then only search the hours?
So folks.
I need to know if I'm going to just send the hours H: i: s from the NOW()
function in the database, or send the NOW()
complete and then only search the hours?
You can do the insert only with the function now()
remember that to use the time it is necessary that the field be datetime
or timestamp
, to display the formatted results use the function date date_format () of mysql, use the minute or second to make comparisons.
SELECT DATE_FORMAT(now(), '%H:%i:%s')
//exemplo do sqlfiddle
SELECT id, date_format(data,'%H:%i:%s') FROM datas WHERE hour(data) = 14
Try formatting the output value, eg:
SELECT DATE_FORMAT(NOW(), '%H:%i:%s');