We help IT Professionals succeed at work.

How to display server time count down?

techques
techques asked
on
Medium Priority
2,548 Views
Last Modified: 2013-12-17
Hi

I use http://www.hashemian.com/tools/javascript-countdown.htm as the js count down.
I get the datetime from server and run the count down js.

However, different machine shows different count down value.

How can the count down timer run in server side, i.e. compare the system time with the future time.
Comment
Watch Question

Commented:
Off the top of my head I can think of two options you might consider using.  As your code currently stands I am sure (\based on how you described the issue) that it is all run via Client Side javascript.  If this is the case that is why the user is seeing different times: Javascript runs on the local computer and does not communicate with the server.

To get the server time you can do one of the two options:
(1) On the ASP Page Load event pass a javascript variable to the user with the current server time.  Then you can compare that time and the 'local' time in your javascript to define the timezone offset.

http://forums.asp.net/t/886754.aspx

(2) You can use a ASP.Net to create and manage the clock frolm the server side without the use of JavaScript.

http://www.planettutorials.com/Articles/ASPNET/tabid/59/articleType/ArticleView/articleId/15/Create-A-Digital-Clock-in-ASPNET-with-Ajax.aspx

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.