If you are storing a frequency I would just store it in seconds as an integer, e.g. 86400 = daily. You can then do maths on it
Jun 18, 2019
2
Level 2
Store time intervals in database
Hello,
What is the most appropriate/efficient way of storing time intervals in a database? I will be using the laravel scheduler. I have a start and end date - but I need to store a frequency between these dates - eg. daily, weekly, fortnightly - for the scheduler.
I was thinking of having another time stamp - last_executed - where the time difference between now and the frequency + last_executed > 0 the scheduler would execute the job?
In this case in what format would you store the frequency? Is there a more efficient way?
Thanks
Level 51
Please or to participate in this conversation.