How to display Date Time in status bar in Internet Explorer ?

Ranjeet_8
Posted by Ranjeet_8 under JavaScript category on | Points: 40 | Views : 2885
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Display Date Time In Status Bar (Internet Explorer)</title>
<script language="JavaScript" type="text/javascript">

function CurrentDateTime() {
var CurrentDate = new Date();

var mm = CurrentDate.getMonth();
var tdy = CurrentDate.getDate();
var yyyy = CurrentDate.getYear();
var hh = CurrentDate.getHours();
var mm = CurrentDate.getMinutes();
var ss = CurrentDate.getSeconds();

// month starts at 0
mm += 1;

if (yyyy < 2000)
yyyy += 1900;

if (hh < 10)
hh = "0" + hh;
if (mm < 10)
mm = "0" + mm;
if (ss < 10)
ss = "0" + ss;

if (hh < 12)
var am_pm = "AM";
else
var am_pm = "PM";

if (hh == 0)
hh = 12;
if (hh >= 13)
hh -= 12;


window.status = mm + "/" + tdy + "/" + yyyy + " " + hh + ":" + mm + ":" + ss + " " + am_pm;
}

setInterval("CurrentDateTime()", 1000);

</script>
</head>
<body>
</body>
</html>

Comments or Responses

Login to post response