A few days ago someone here got me interested in php, so i thought i would try some more and i found this script<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />$newdate = date("Y-m-d H:i:s", strtotime("6 HOUR"));<br /><br />echo $newdate; <br />?><!--c2--></div><!--ec2--><br />Which shows the current time and date.<br /><br />The problem is that the time is static. The time is still the same, even 10 minutes after the visitor arrived to the site unless the visitor refresh the page itself (or frame in my case).<br /><br />Can this code be changed to refresh itself, doesnt have to be every second but each minute would be nice.<br /><br />Or should i change script completely?<!--content-->
I don't think so. PHP is processed by the server as the page is being sent to the user's browser so since there is no refresh of the page the clock will remain static.<br /><br />You will have to use a META refresh tag on the page to have it reload or use something in javascript or the clock in cPanel.<!--content-->
Ok.<br />Thanks Bruce <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Check hotscripts.com for a javascript snippet. Javascript runs on the visitor's pc so it can do up-to-the-second updates. As Bruce said, PHP is interpreted by the server so you don't have the same flexibility.<!--content-->
I found this code a while ago. At that time i used it on a english speaking site so i didnt have to change anything but now i wanna use it on a swedish site and we use 24h time.<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><HEAD><br /><br /><script LANGUAGE="javascript"><br /><!-- Original: Â Craig Lumley --><br /><!-- Web Site: Â http://www.ws4all.co.uk --><br /><br /><!-- This script and many more are available free online at --><br /><!-- The javascript Source!! http://javascript.internet.com --><br /><br /><!-- Begin<br />function MakeArrayday(size) {<br />this.length = size;<br />for(var i = 1; i <= size; i++) {<br />this = "";<br />}<br />return this;<br />}<br />function MakeArraymonth(size) {<br />this.length = size;<br />for(var i = 1; i <= size; i++) {<br />this = "";<br />}<br />return this;<br />}<br />function funClock() {<br />if (!document.layers && !document.all)<br />return;<br />var runTime = new Date();<br />var hours = runTime.getHours();<br />var minutes = runTime.getMinutes();<br />var seconds = runTime.getSeconds();<br />var dn = "AM";<br />if (hours >= 12) {<br />dn = "PM";<br />hours = hours - 12;<br />}<br />if (hours == 0) {<br />hours = 12;<br />}<br />if (minutes <= 9) {<br />minutes = "0" + minutes;<br />}<br />if (seconds <= 9) {<br />seconds = "0" + seconds;<br />}<br />movingtime = ""+ hours + ":" + minutes + ":" + seconds + " " + dn + "";<br />if (document.layers) {<br />document.layers.clock.document.write(movingtime);<br />document.layers.clock.document.close();<br />}<br />else if (document.all) {<br />clock.innerHTML = movingtime;<br />}<br />setTimeout("funClock()", 1000)<br />}<br />window.onload = funClock;<br />// Â End --><br /></script><br /></HEAD><!--c2--></div><!--ec2--><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><BODY><br /><span id=clock style="position:relative;"></span><!--c2--></div><!--ec2--><br />Is there any way I can get rid of AM/PM and make it show 13, 14, 15 and so on instead of 1, 2, 3...?<!--content-->
That would show the visitor's current date & time is there some way to display the servers data & time through java. And in that process show my date & time by adding a number to the server's !<!--content-->
I got confused over your answer Arvind. Sorry. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid="" border="0" alt="sad.gif" /> <br />But, please disregard my last post, cause i found a script that does exactly what i want.<br />If you wanna look, take a look at the top in LEFT frame at <a href="http://assistans.marve.se" target="_blank">this page</a>.<!--content-->
I don't think so. PHP is processed by the server as the page is being sent to the user's browser so since there is no refresh of the page the clock will remain static.<br /><br />You will have to use a META refresh tag on the page to have it reload or use something in javascript or the clock in cPanel.<!--content-->
Ok.<br />Thanks Bruce <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Check hotscripts.com for a javascript snippet. Javascript runs on the visitor's pc so it can do up-to-the-second updates. As Bruce said, PHP is interpreted by the server so you don't have the same flexibility.<!--content-->
I found this code a while ago. At that time i used it on a english speaking site so i didnt have to change anything but now i wanna use it on a swedish site and we use 24h time.<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><HEAD><br /><br /><script LANGUAGE="javascript"><br /><!-- Original: Â Craig Lumley --><br /><!-- Web Site: Â http://www.ws4all.co.uk --><br /><br /><!-- This script and many more are available free online at --><br /><!-- The javascript Source!! http://javascript.internet.com --><br /><br /><!-- Begin<br />function MakeArrayday(size) {<br />this.length = size;<br />for(var i = 1; i <= size; i++) {<br />this = "";<br />}<br />return this;<br />}<br />function MakeArraymonth(size) {<br />this.length = size;<br />for(var i = 1; i <= size; i++) {<br />this = "";<br />}<br />return this;<br />}<br />function funClock() {<br />if (!document.layers && !document.all)<br />return;<br />var runTime = new Date();<br />var hours = runTime.getHours();<br />var minutes = runTime.getMinutes();<br />var seconds = runTime.getSeconds();<br />var dn = "AM";<br />if (hours >= 12) {<br />dn = "PM";<br />hours = hours - 12;<br />}<br />if (hours == 0) {<br />hours = 12;<br />}<br />if (minutes <= 9) {<br />minutes = "0" + minutes;<br />}<br />if (seconds <= 9) {<br />seconds = "0" + seconds;<br />}<br />movingtime = ""+ hours + ":" + minutes + ":" + seconds + " " + dn + "";<br />if (document.layers) {<br />document.layers.clock.document.write(movingtime);<br />document.layers.clock.document.close();<br />}<br />else if (document.all) {<br />clock.innerHTML = movingtime;<br />}<br />setTimeout("funClock()", 1000)<br />}<br />window.onload = funClock;<br />// Â End --><br /></script><br /></HEAD><!--c2--></div><!--ec2--><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><BODY><br /><span id=clock style="position:relative;"></span><!--c2--></div><!--ec2--><br />Is there any way I can get rid of AM/PM and make it show 13, 14, 15 and so on instead of 1, 2, 3...?<!--content-->
That would show the visitor's current date & time is there some way to display the servers data & time through java. And in that process show my date & time by adding a number to the server's !<!--content-->
I got confused over your answer Arvind. Sorry. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid="" border="0" alt="sad.gif" /> <br />But, please disregard my last post, cause i found a script that does exactly what i want.<br />If you wanna look, take a look at the top in LEFT frame at <a href="http://assistans.marve.se" target="_blank">this page</a>.<!--content-->