Marcusw
asked on
How to create a count down timer
i need to create a countdown timer that count down the hours, mins, and seconds on my website.
i nee the time to be based on my server (server based in US but i need to translate to UK time).
i need to countdown till 5pm every day then show a message until 7pm then start the counter again for the next day.
i have very little experience with javascipt so an help is appreciated
thanks
i nee the time to be based on my server (server based in US but i need to translate to UK time).
i need to countdown till 5pm every day then show a message until 7pm then start the counter again for the next day.
i have very little experience with javascipt so an help is appreciated
thanks
var now = new Date();
this takes the time of client's browser.
You cannot get server time in javascript, as it is client-side script.
what you can do is generate in some server-side language (PHP,JSP,ASP whatever) a javascript parsable object (with server time).
in java it could look like this:
var now = Date.parse(<%=SomerServerU tilClass.g etTimeStri ng()%>);
this takes the time of client's browser.
You cannot get server time in javascript, as it is client-side script.
what you can do is generate in some server-side language (PHP,JSP,ASP whatever) a javascript parsable object (with server time).
in java it could look like this:
var now = Date.parse(<%=SomerServerU
ASKER
great thanks for the code, that seems very close.
I have 2 questions though
where is the time taken from, i need it to be from our server, but this seems to be from the computer as the same page shows different times on 2 different computers
also
the message welcome to the twilight zone only shows for so many seconds, not hours why is this
thanks
I have 2 questions though
where is the time taken from, i need it to be from our server, but this seems to be from the computer as the same page shows different times on 2 different computers
also
the message welcome to the twilight zone only shows for so many seconds, not hours why is this
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window