-
-
display date and time
Try this code in html's Body tag to display date and time in your site.
<script>
<!--
day = new Date()
hr = day.getHours()
mn = day.getMinutes()
mnt = mn
hr1 = hr - 12
if (mnt <= "9") {
mnt = '0'+mn
}
if (hr < "1") {document.write("Good Morning. It's 12:"+mnt+" am. ")
}
else if (hr < "4") {document.write("Good Morning. It's "+hr+":"+mnt+" am. ")
}
else if (hr < "12") {document.write("Good Morning. It's "+hr+":"+mnt+" am. ")
}
else if (hr < "13") {document.write("Good Morning. It's "+hr+":"+mnt+" pm. ")
}
else if (hr < "17") {document.write("Good Afternoon. It's "+hr1+":"+mnt+" pm. ")
}
else if (hr < "23") {document.write("Good Evening. It's "+hr1+":"+mnt+" pm. ")
}
else if (hr > "22") {document.write("Good Night. It's "+hr1+":"+mnt+" pm. ")
}
//-->
</script>
<script>
var now=new Date();
var mys= new String(now);
var len=mys.length;
var len1=len-4;
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","Thu rsday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")
document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</font>")
</script>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks