Here you go
time.php
HTML file
javascript from : http://www.w3schools.com/Ajax/ajax_xmlhttprequest.asp
If you want to output only Hours:Minutes just remove "" from the date() function
time.php
PHP Code:
<?php
print date("H:i:s");
?>
HTML file
javascript from : http://www.w3schools.com/Ajax/ajax_xmlhttprequest.asp
Code:
<html>
<head>
<script type="text/javascript">
function ajaxFunction()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
document.getElementById("clock").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","time.php",true);
xmlhttp.send(null);
}
</script>
</head>
<body onload="setInterval('ajaxFunction()', 1000);">
<div id="clock"></div>
</body>
</html>
If you want to output only Hours:Minutes just remove "" from the date() function
PHP Code:
<?php
print date("H:i");
?>