Counting down the days when using time()?

0 like 0 dislike
10 views
Hi all, are sitting around scratching their heads how to implement a countdown to the day when you use the function time()

Example:

The user can perform only one action per day, BUT the implementation should be as follows. The day are not adding to time() + 86400 seconds, and the calculation to 00.00. Ie 00.01 already considered a new day as it should be. And the user can perform the action again!
by | 10 views

5 Answers

0 like 0 dislike
the easiest way is date('Ymd', time())
by
0 like 0 dislike
Em. Why are you here time?
Completed man action recorded unity. Upon the occurrence of 00:00:00 resets all the ones and again you can take action, no?
by
0 like 0 dislike
Advice — reminder. Don't forget your scripts to take into account timezones of the users and then get it for a single day begins and ends at 0:00 and the other 3:00
by
0 like 0 dislike
And another tip-reminder. If you use math with seconds — do not forget that a year there is a day of 23 hours and a day of 25 hours. In the days of the clock.
by
0 like 0 dislike
$last_action_time = '2010-12-07 26:35:21'; // there's got to be saved from the database
if(strtotime($last_action_time) < strtotime('today')) {
// allow
} else {
// disallow
}
\r
by
110,608 questions
257,186 answers
0 comments
28,707 users