Hi I have a question from web designers and programmers How websites update and run their time?! for example live scores websites and forums or many websites that time is important how create time for their sites? I want to know If their server was down the time is goes back too ? if no why and how update time? for example if server was down for 5 min so time is 5 min back, right?
Could you rephrase your question? As i am not sure what do you want to track exactly. If it is uptime you want to track - look google for "uptime check tool" and you will fine many sites about it.
Thanks andylaw I want to know how to develop a time and date for a site? how run and update this time and date? If time update with server so the server is down the time is down too Time for some sites is important like livescore.com or sportsbook so how they create a time for their websites that update for all I know somebody design time that updates with user time but this way is not good somebody design time that updates with other sites but which site and is it a good way?
If you want the user to see the time where he is, use Javascript. There are many examples on the web. If you want the user to see the time on the server, use PHP or whatever language you're using on the server. In any case, that will be the time when the user connects his browser to the site. It doesn't matter whether the site is down or not - the time is always the current (at the time it's read) time. It's like your computer. You turn it off. When you turn it on the next day, it isn't still keeping yesterday's time, it shows the current time. If you're using Javascript, it shows the local time on the user's computer. If you use server-side code it shows the local time on the server computer.
Thanks Rukbat There is another question! You said server-side code shows the local time on the server computer so if we want GMT time and for example sever location is in Canada we can develop a time that canada time-7 GMT time but if we change server location for example in UK the time show incorrect time, right? Can design a server-side code that always shows correct time even with change sever location?!
You can insert the date and time that the page was downloaded with this: <!--#echo var="DATE_LOCAL"--> wiz
Yes - PHP is aware of the local timezone on the computer, so you can always make your code dependent on the timezone. What you can't know, until you run the code and see the results, is whether the server is set to local time or GMT. (Not everyone adheres to standards.) But once the code for both is in place (and one is commented out), it takes a few seconds to switch between one and the other.