I was wondering, if somebody has a code snippet to allow a page to show the number of days to a given event.
For example, today its 105 days until the Bush tax cuts expire.
Once I see how to do it, I can then use the code for other countdowns such as to election days etc.
Date Based Countdown
Moderator: General Moderators
Date Based Countdown
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: Date Based Countdown
Timestamps are expressed in seconds. There are 86400 seconds in a day. Use subtraction to find the difference between two timestamps and division to convert seconds to days.
PHP provides a number of date and time functions.
PHP provides a number of date and time functions.
Re: Date Based Countdown
Not necessarily. It's not true for days when there's dst / non-dst change. Also you forgot about leap seconds.McInfo wrote:There are 86400 seconds in a day.