wmguk Posted September 29, 2009 Share Posted September 29, 2009 Hey, I need a way to display shop opening hours, and they want 9-5 in green, then 5.01 - 8.59 in red. I can sort that, but cannot find a way to actually have it update live, so im on the home page, and the time is ticking... Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/175963-best-way-to-show-the-current-time/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 29, 2009 Share Posted September 29, 2009 If you want a time displayed in the browser that changes colors in real time as the visitor is displaying a web page, you would need to use javascript. There are various javascript clock scripts posted all over the Internet. It would only take a small amount of logic to test the time value and alter the color. If you want the server's time to be used as the reference instead of the visitor's, you would need to output the server's time as the starting value for the javascript to use. Edit: For example - http://www.dynamicdrive.com/dynamicindex6/localtime.htm Quote Link to comment https://forums.phpfreaks.com/topic/175963-best-way-to-show-the-current-time/#findComment-927187 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.