Adding Todays Date in HTML

  glen2409 18:31 15 Mar 06
Locked

Hi,

I am fairly new to web design and have used Frontpage. On the sites homepage I want to show the current date and for it to be updated each day dynamically.

Does anyone know the HTML code to do this.

Thanks

  mco 18:39 15 Mar 06

<script>

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.write("<small><font color='003366' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" </b></font></small>")

</script><span id=tick2>

</span>


<script>
<!--
/*
By George Chiang (WA's JavaScript tutorial)
click here
*/

function show2(){
if (!document.all)
return


var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM"

if (hours>12){
dn="PM"
hours=hours-12
}

if (hours==0)
hours=12

if (minutes<=9)
minutes="0"+minutes

if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
tick2.innerHTML="<b style='font-size:14;color:003366;'>"+ctime+"</b>"
setTimeout("show2()",1000)
}

window.onload=show2
//-->
</script>

This thread is now locked and can not be replied to.

Huawei P10 review

1995-2015: How technology has changed the world in 20 years

An overview: What leading creative agencies are doing to improve diversity

New iPad, iPhone SE & Red iPhone 7 on sale now