Answer the question
In order to leave comments, you need to log in
How to determine which time interval the current time belongs to?
There are some blocks of data tied to a specific time. Let's say the data is for 04:00, 10:00, 16:00, 22:00. And so daily. How to determine that the current time is 01:47 - closer to 04:00, but already by 04:00 the next day?
Answer the question
In order to leave comments, you need to log in
timestamp // 86400
timestamp % 86400
Add additional interval = first interval + 24 hours (28 hours in your case).
Get the number of seconds since the beginning of the day.
Determine the next interval.
If the found interval is the last one. That means moving on to the next day.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question