R
R
Roman Gor2015-03-20 11:17:31
PHP
Roman Gor, 2015-03-20 11:17:31

How to build repetitions in the mention manager?

Hello!
Actually, a topic for discussion.
How to line up mention repetitions (1 day, 3 days, week) without specified end date?
The first and easiest option is to fill the database with values ​​for 100 years ahead, for example. I think this solution is completely redundant. + I need to monitor these mentions in the calendar, i.e., by going to the same day of the next year, for example, I should see the mention I left.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
He11ion, 2015-03-20
@He11ion

Stupidly looking for the remainder of dividing the number of the day (hour, minute, etc) by the desired period

S
ShamblerR, 2015-03-20
@ShamblerR

Aw.. gentlemen.
the official version of the day of the week will not suit you 1-7

M
Maxim Uglov, 2015-03-21
@Vencendor

date (start_date, delta_time)
output notifications ,
find out the remainder of the division between the simplest time and the period
(time()-start_date)% delta_time
if exactly 0, then now is exactly the moment when a reminder should occur
for real work, you need to compare not with 0, but with some range,
for example if the result is 56, then 56 seconds have passed since the reminder should have been started
conf_if_time=1800;
as a result:
if((time()-start_date)%delta_time < conf_if_time or (time()-start_date)%delta_time > delta_time-conf_if_time) {
// what you need
}
in general, how to arrange all this in sql, think for yourself. everything seems to be working

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question