Welcome Guest, Not a member yet? Register   Sign In
how to show countdown timer on webpage
#1

[eluser]teddy[/eluser]
I make a small deal/groupon website and I need show countdown time from database with start date and end date, and at front page I will show day, hours and minute and show or not show seconds, but I can't how to make it.


Thank you for reading topic.
#2

[eluser]CroNiX[/eluser]
If you want it to countdown in the users browser in real-time, then you need to use javascript. Basically you'd get the start time (months/days/hours/minutes/seconds left) from the server when the page is created and then the javascript will make it countdown from there.

There is a million javascript scripts out there that will do this if you search around. Something like this.
#3

[eluser]Unknown[/eluser]
Is it possible in actionscript too???

http://www.quintonic.fr
#4

[eluser]teddy[/eluser]
@CroNiX: can you explain a bit more, I have two fields start date & end date in database and I will compare they with current time if end date is < current date the deal will be over

Thank you for your help
#5

[eluser]boltsabre[/eluser]
something like this, but you'll have to code it yourself.

1. Get the end date/time. Get the current time, work out the difference. This is your "time left"
2. Pass "time left" to your view in a div, or whatever you want it displayed in.
3. Using Javascript, get this "time left" and start "counting down". Display this counting down to the user.

Notes:
* You'll have to ensure that the start/end date/time you store is set to the correct timezone. What if a "coupon" customer sets it to end at midnight their time (what time zone are they in?). It's no good if you go and set that time to a different time zone is it, because then your date/time will be incorrect. I'll let you figure that out.
* In step 1 above, when working out the "time left" you will have to get the "end time" and "end time time zone" AND the current time IN THE SAME TIME ZONE otherwise your "time left" will be incorrect.
* If you don't get this correct, depending on what country you are in, you may be liable for costs if you get this wrong. For example, if the coupon has already expired but your website says it is still active for another two hours, you MAY be forced to pass the coupon onto your customers with you paying the difference between the coupon price and the full price. I'd research your local laws and/or potentially hire an internet lawyer to write your "terms and conditions" to help mitigate this eventuality.




Theme © iAndrew 2016 - Forum software by © MyBB