I’m trying to make countdown timer that resets itself every 60 minutes and wont reset on every refresh.
I think the ideal way to do this is via timezone?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are multiple ways to perform this, but usually i’d recommend storing the unix-timestamp in a MySQL Database, then fetch and compare the previous/stored unix-timestamp with the current timestamp. The PHP-function time() will get you the current timestamp.
If the entire project is about making a counter, you can probably achieve the same effect by writing/loading from a text-file. The same goes for sessions.
Here’s a little snippet to give you an idea of how to solve this: