
// *************************************************************************************
// Simple Date Javascript
//  Explanation: This script is designed to produce today's date in the format of
//               "Monday July 29, 2002". If you don't like that format, you can
//               play with the script to produce many other formats. See the variable
//               definitions for further hints/explanations. 
//
// Usage: In the head of your document put this script. (you knew that, right?)
//        In the body of your document put: <SCRIPT Language="JavaScript">SimpleDate()</script>
//
// How to format your date(s):
//                              DayNumber   = 1 through 28/29/30/31 (depends on month)
//                              DayOfWeek   = 0 through 6 (add 1 for 1 to 7)
//                              MonthNumber = month number (Jan. = 1, Dec. = 12)
//                              Year        = whatever the year is, i.e. 2002
//                              MonthName   = the current month name, i.e. July
//                              DayName     = the current day name, i.e. Monday
//
// Examples (change last line of script):
//     (1) Monday July 29, 2002
//         document.writeln(DayName, " ", MonthName, " ", Day, ", ", Year);
//     (2) 07/29/2002
//         document.writeln(MonthNumber, "/", DayNumber, "/", Year);
//
// Future Work:
//      * Add in a 2-digit year variable (i.e. 02)
//      * Add in day of year (i.e. the 66th day of 2002)
//      * Add in days left in year (i.e. 33 days left in 2002)
//      * Add in week variables (i.e. 7th week, 45 weeks left in year)
//      * Add in date calculations and countdowns (I have some of this laying around)
//      * Add in some predefined date formats to give more flexibility in usage
//        (i.e. format "1" would return 7/29/02 while format "2" would return 29July2002...)
//
// Version: 0.92
// Date: 29JULY2002
// Author: Eric Zander (eric_zander@yahoo.com)
//
// NOTE: This script is free... please send me an email letting me know you're using it and what you think.
//       
// *************************************************************************************


function SimpleDate() {

	// Define today.
	var Today = new Date();
	// grab today's date from the client box
	var DayNumber = Today.getDate();
	// Find out what day of the week it is (a zero-based number, Sunday = 0)
	var DayOfWeek = Today.getDay();
	// Find out what the month number is (getMonth is zero based, add one to make it right)
	var MonthNumber = Today.getMonth()+1;
	// Figure out what the year is...
	var Year = Today.getFullYear();

	// These three arrays are for converting month day numbers, months and years to our calendar.
	MonthNames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
	DayNames = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');

	// These next two variables have to be below the arrays.
	var MonthName = MonthNames[Today.getMonth()];
	var DayName = DayNames[Today.getDay()];

	// Here is where you get to put it all together.
	document.writeln(DayName, " ", MonthName, " ", DayNumber, ", ", Year);
	}