This is a countdown timer with a difference. It doesn't just display the time remaining until the clock on your visitor's computer reaches a specified date and time. It counts down until a specific date and time is reached at the page location. So I am in New York, USA (timezone -5) so if you are located in London, UK (timezone +0) then the countdown timer will show 5 hours more than you would expect there to be until the specified time because the timezone countdown timer is counting down to that time in New York, not London.
The script able do this because it both takes into account the timezone offset of your visitor's computer and also allows you to specify the timezone offset that you want it to apply to, so as to save you the effort of adjusting the time that you enter to UTC. International Time Zones can be found here.
The month can be specified as a number between 1 and 12 to indicate which month of the year that you are counting down to (it will assume next year if the month has already past for this year) or you can specify '*' to have the counter select the appropriate date within the next month. If you do specify a numeric month then the countdown will stop once it reaches zero with a "Sorry Too Late" message but if it is set to monthly then it will automatically restart the countdown for the next month (but only if the page is reloaded). You can also set the month to '0' which will always be matched to the current month.
The day can be specified as a given day of the month (1 through 31) or you can put a + in front of a number to indicate so many days in the future (useful for "limited time offers" that never expire). You can even specify '+0' to countdown to a specific time each day.
The hour should be specified in 'military time' (ie. between 0 and 23, 0 = midnight, 23 = 11 p.m.) to indicate the time of day that the offer expires.
The timezone offset is also specified in hours and should be the number of hours that your local time is ahead (positive number) or behind (negative number) Universal Coordinated Time (UTC also known as GMT or Zulu Time).
You would only need to adjust the timezone if you want the daylight saving at your location taken into account.
The following are some combination examples that you may find useful.
- To countdown to the end of each month - month = '*', day = '1', hour = 0
- To countdown to the 21st of each month - month = '0', day = '21', hour = 0
- To countdown to the end of each day - month = '0', day = '+1', hour = 0
- To countdown to Noon tomorrow - month = '0', day = '+1', hour = 12
- To countdown to 4 p.m. today - month = '0', day = '+0', hour = 16
- To countdown to Christmas - month = '12', day = '25', hour = 0
The amount of time remaining on the countdown timer is only calculated once when the web page is loaded.
After that the count is reduced by 1 approximately once per second so as to reduce the amount of processing required to recalculate the values to show.