The month number for the receiving date object is returned. This is a zero based value in the range 0 to 11 inclusive. The value 0 represents January, and 11 represents December.
The value is in local time coordinates.
<HTML>
<HEAD></HEAD>
<BODY>
<SCRIPT>
myDate = new Date();
myMonth = myDate.getMonth();
egyptianCalendar(myMonth);
// Generate attributes of the Egyptian calendar based on month
function egyptianCalendar(aMonth)
{
mySeasonArray = new Array("Akhet", "Peret", "Shemu");
myMonthArray = new Array("I", "II", "III", "IV");
myNameArray = new Array("Thoth", "Phaophi", "Athyr", "Choiak", "Tybi", "Mechir", "Phamenoth", "Pharmuthi", "Pachons", "Payni", "Epiphi", "Mesore");
myDeityArray = new Array("Tekhi", "Ptah-aneb-res-f", "Het-hert", "Sekhet", "Amsu", "Rekeh-ur", "Rekeh-netches", "Rennutet", "Khensu", "Kenthi", "Apt", "Heru-khuti");
myTypeArray = new Array("F", "M", "F", "F", "M", "M", "M", "F", "M", "M", "F", "M");
mySeason = mySeasonArray[Math.floor(aMonth/4)];
myMonth = myMonthArray[aMonth%4];
myName = myNameArray[aMonth];
myDeity = myDeityArray[aMonth];
switch(myTypeArray[aMonth])
{
case "F" : myType = "Goddess";
break;
case "M" : myType = "God";
break;
}
document.write("Index : " + aMonth + "<BR>");
document.write("Season : " + mySeason + "<BR>");
document.write("Month : " + myMonth + "<BR>");
document.write("Name : " + myName + "<BR>");
document.write("Deity : " + myDeity + "<BR>");
document.write("Type : " + myType + "<BR>");
}
</SCRIPT>
</BODY>
</HTML>| See also: | Date.prototype, Date.setMonth(), Date.setUTCMonth() |
| Prev | Home | Next |
| Date.getMinutes() | Up | Date.getSeconds() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||