• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Showing server time on website...

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
I have been looking on internet for around 2 hours and couldn't find this "script"... Just things that show your hour... I need something that show server hour... Anyone know how?
 
Thanks, I tried to implement in a javascript that actualice it every second...Bug I couldnt... Any idea?

PHP:
<div class="mng2">La hora en mtibia</div>			
	<SCRIPT LANGUAGE="JavaScript">
<!-- Mas trucos y scripts en http://www.javascript.com.mx -->
<!-- Original: Michael Tartaglia <[email protected]> -->
<!-- Begin
day = new Date();
miVisit = day.getTime();
function clock() {
dayTwo = new Date();
hrNow = dayTwo.getHours();
mnNow = dayTwo.getMinutes();
scNow = dayTwo.getSeconds();
miNow = dayTwo.getTime();
if (hrNow == 0) {
hour = 12;
ap = " AM";
} else if(hrNow <= 11) {
ap = " AM";
hour = hrNow;
} else if(hrNow == 12) {
ap = " PM";
hour = 12;
} else if (hrNow >= 13) {
hour = (hrNow - 12);
ap = " PM";
}
if (hrNow >= 13) {
hour = hrNow - 12;
}
if (mnNow <= 9) {
min = "0" + mnNow;
}
else (min = mnNow)
if (scNow <= 9) {
secs = "0" + scNow;
} else {
secs = scNow;
}
time = hour + ":" + min + ":" + secs + ap;
document.form.button.value = time;
self.status = time;
setTimeout('clock()', 1000);
}
function timeInfo() {
milliSince = miNow;
milliNow = miNow - miVisit;
secsVisit = Math.round(milliNow / 1000);
minsVisit = Math.round((milliNow / 1000) / 60);
message = "Has estado " + milliNow + " milisegundos en esta pagina"+ "... esto es " + minsVisit + " minutos" ;
message = message + ", y "+ secsVisit + " segundos.";
alert(message) ;
}
document.write("<br><center><form name='form'>"+ "<input type=button value='Click for info!'"+ " name=button onClick='timeInfo()'></form></center>");
onError = null;
clock();
// End -->
</SCRIPT>
 
What's wrong with the PHP solution, isn't that what you were asking for? google for the javascript solution, you'll find it if you do.
 
I googled it and nothing, what I need is a script that show server hour (not your computer hour) and refresh it every second, like making a real live time clock.
 

Similar threads

Replies
8
Views
3K
Back
Top