Search time in mysql

Asked

Viewed 79 times

0

Colleagues,

I have a system that is storing the time of registration of users in the following format in the Mysql database:

11:11:00 ( the time may be any other as per the user’s registration )

But I created a Cron task where every minute I do a check in the database and run a task based on the user’s registration time. I used the following code for verification:

SELECT * FROM tabela WHERE DATE_FORMAT(Data, '%Y-%m-%d') = CURDATE() AND Hora =  TIME(CURRENT_TIMESTAMP);

The problem is that if the above code time passes the registration time, it does not perform the task. Ex.:

Registration time is 11:11:00 and the code time is 11:11:01, does not perform the task.

  • you have a column for date and another for time ?

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.