obviamente que si lo hace con un lenguaje del lado del servidor (independientemente de cual quiera utilizar) no verá la hora en tiempo real a no ser que se recargue toda la página, pero, no es necesario utilizar ajax y mucho menos cargar la web con un framework que solo hará ese trabajo, esto se logra con simple javascript puro:
Código html:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> function hoy(){
var fechaActual = new Date();
dia = fechaActual.getDate();
mes = fechaActual.getMonth()+1;
anno = fechaActual.getFullYear();
if (dia <10) dia = "0" + dia;
if (mes <10) mes = "0" + mes;
fechaHoy = dia + "/" + mes + "/" + anno;
return fechaHoy;
}
function mueveReloj(){
var momentoActual = new Date();
if(momentoActual.getHours()) var hora=String(momentoActual.getHours());
else{
var cadena=String(momentoActual);
var hora = String(cadena.substring(10,12));
}
//document.getElementById('hora').innerHTML= hora;//typeof(momentoActual);
var minuto = String(momentoActual.getMinutes());
var segundo = String(momentoActual.getSeconds());
if (segundo.length == 1)
segundo = "0" + segundo;
if (minuto.length == 1)
minuto = "0" + minuto;
if (hora.length == 1)
hora = "0" + hora;
horaImprimible = " "+hora + " : " + minuto + " : " + segundo;
document.getElementById('hora').innerHTML= horaImprimible;
setTimeout("mueveReloj()",1000);
}
<body onload="mueveReloj();">
solo tendría que bastar con eso.
Edito:Coloque todo en un solo archivo para que sea mas entendible