Love2c0de Posted January 25, 2013 Share Posted January 25, 2013 (edited) To create a live updating clock with PHP? Are there variations depending on where a server is hosted which can make it inaccurate for a user? For example is someone lives in east USA, they may be connected to a server in mid america which would create a time difference.... I live in south UK and have been connected to a server in Scotland before so that distance across america could cause a time difference for someone. I'd rather use a serverside language rather than javascript but I know a Javascript clock is based on users local time so it will be accurate. I've searched google and php.net and can't seem to find anything relating to PHP timers/clocks...... Thank you for your thoughts. Kind regards, L2c. Edited January 25, 2013 by Love2c0de Quote Link to comment https://forums.phpfreaks.com/topic/273613-is-there-a-way/ Share on other sites More sharing options...
gizmola Posted January 25, 2013 Share Posted January 25, 2013 Almost all competent technical organizations use some sort of time synchronization, and set all their servers to use UTC. Some of the things you seem to be alluding to are locale based. If you know what the user's locale is, you can take a UTC datetime and convert it relative to their timezone. PHP's datetime object when combined with the timezone object is fully featured in allowing you to convert a UTC datetime to whatever timezone you want. Clearly a clock, should be running on the user's workstation. You could implement a flash, java or javascript based clock that is initialized to a known datetime value (with timezone string) and then display it. With that said, I don't really know (outside of a worldclock type console) what an application of this idea would be. Quote Link to comment https://forums.phpfreaks.com/topic/273613-is-there-a-way/#findComment-1408081 Share on other sites More sharing options...
Love2c0de Posted January 25, 2013 Author Share Posted January 25, 2013 Thank you for your replies. I know it seems redundant to create a clock and display it on a webpage and I completely agree with you. I just wanted to add some content to my left sidebar on my website and was struggling for ideas! Thanks for your advice, I'll have a look into those techniques. Regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/273613-is-there-a-way/#findComment-1408083 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.