Good day.

There is a table in the database. You need to update it every two hours. We write the time in the table, in php we pull out the current time and compare, and if the result is suitable for the conditions, then UPDATE, not so no. Question: how to compare two dates? Format, for example, ( 10:21:32 /hh:mm:ss ).

  • and what cron does not fit? - terantul

2 answers 2

Use strtotime () and compare the difference between dates for example with time ()

    If you are storing data in a table, use a date / time type, for example, datetime. Then you can calculate the time interval between two dates using the TIMESTAMPDIFF function (for some reason it seemed to me that you are using MySQL).