Posted on March 27, 2012 by Michael Rosario
Total Posts: 33 | Join date: 03-12-11
<script type="text/javascript" language="JavaScript">
// WE SETUP THE FUNCTIONS
function getCurrentDate()
{
var months = new Array(13);
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";
var now = new Date();
var mnum = now.getMonth();
var m = months[mnum];
var d = now.getDate();
var y = now.getYear();
if(y < 2000) { y = y + 1900; }
var dateString = m + ' ' + d + ', ' + y;
return dateString;
} // Used to get the current Date
function getCurrentTime()
{
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
var dn = "AM";
if (h > 11) { dn = "PM"; }
if (h > 12) { h = hour - 12; }
if (h == 0) { h = 12; }
if (h < 10) { h = "0" + hour; }
if (m < 10) { m = "0" + minute; }
if (s < 10) { s = "0" + second; }
var timeString = h + ':' + m + ':' + s + " " + dn;
return timeString;
} // Used to get the current Time
//-->
</script>
<script type="text/javascript" language="JavaScript">
<!--
// This is to display the time and date on your site.
var calendarDate = getCurrentDate();
var clockTime = getCurrentTime();
document.write('The date is' + calendarDate + '<br />');
document.write('The current time is ' + clockTime);
//-->
</script>
Tags: There are no tags for this entry.