PHP Timer/Countdown - Database

I want to take a timestamp from my database and increase in time(make it later) when I click on a button(This is not the problem though). With the timestamp I want to see how much longer till then from now. How would I do this? Thanks.

assuming they’re unix timestamps, you can do that right from the mysql query. i’m not sure of the exact query function, but any search engine can give you that :wink:

You can use PHP’s DateDiff function…

I save my timestamps this way: date(‘Y-m-d H:i:s’)
I store it in a field called TimeStamp.
When needed in a page I use a variable like this: $timestamp=date(‘Y-m-d H:i:s’);

DateDiff is a little tricky as you have to tell it exactly what you what to compare, but here is the link:

http://php.net/manual/en/function.date-diff.php

Hope this helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service