I'm making a site with a class schedule for teachers. I need to remove information about elapsed days from a database. What is the best way to track that it is now 12 midnight? if I do seТinterval(function, 24 hours), I have to start the server at 12 midnight sharp. If I do seТinterval every hour, checking what time it is, then the problem is about the same, you need to start the server at 0 minutes. Can you please tell me the best way to track that the day has changed?
Asked
Active
Viewed 45 times
1 Answers
0
As far as I understand your server is not running all the time? If it's true you should try to check and delete data from the past every time when the server starts running. Or you can use npm cron https://www.npmjs.com/package/cron if your server keeps running all the time

Олег Шубин
- 25
- 6