/*
Date and Time Script
Modified by K. Myles Becker
11/25/2002
*/

var Days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var Months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

var today = new Date();
var Year = takeYear(today);
var Month = today.getMonth()+1; //Months are 0-11 in computerspeak - if you want to use the numbered month, this is how to get that #
var MonthName = Months[today.getMonth()]; //since arrays work from 0, use this to get the Month Name from the array above
var Day = today.getDate();
var DayName = Days[today.getDay()]; //Again, use this to get the Day Name from the array above
var Hours = today.getHours();
var ampm = "am";
if (Hours == 0) Hours = 12;
if (Hours > 11)
	ampm = "pm";
if (Hours > 12)
	Hours -= 12;
var Minutes = leadingZero(today.getMinutes());
var Seconds = leadingZero(today.getSeconds());

function takeYear(theDate) // grabs the correct year
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function leadingZero(nr) // adds a leading "0" to those things you want it to, just call it above in the declarations
{                        // currently only minutes and seconds have the leading "0"
	if (nr < 10) nr = "0" + nr;
	return nr;
}

var dtSent = DayName + ' - ' + Hours + ':' + Minutes + ' ' + ampm + ' ' +  MonthName + ' ' + Day + ', ' + Year;

/* Output Usage:
It is Wednesday, December 20, 2002 at 10:25 am
document.write('It is ' + DayName + ', ' + MonthName + ' ' + Day + ', ' + Year + ' at ' + Hours + ':' + Minutes + ' ' + ampm);

12/20/2002 - 10:25:35 am
document.write(Day + '/' + Month + '/' + Year + ' - ' + Hours + ':' + Minutes + ':' + Seconds + ' ' + ampm);
*/


