J'ai utilisé ça sur un site il y a quelques temps, mais je ne sais plus d'où ça vient (pas moi qui l'ai fait) :
Code :
<div id="time">
<span id="clock">
<script type="text/javascript">
<!-- Begin
var montharray=new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre")
function getthedate() {
var mydate=new Date()
var year=mydate.getFullYear()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym < 10) {
daym="0"+daym
}
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
if (hours > 24) {
hours=hours-24
}
if (minutes<=9) {
minutes="0"+minutes
}
if (seconds<=9) {
seconds="0"+seconds
}
//change font size here
var cdate= daym + " " + montharray[month]+" "+year+" "+hours+":"+minutes+":"+seconds
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit() {
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
window.onload=goforit
{
var z = 1;
}
// End -->
</script>
</span>
</div>