This method returns a day number within a month from the date value of the receiving object. The value is 1 based and will not exceed 31 although the range is variable based on month and leap year contexts.
The date is computed according to local time coordinates.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> // Create diary of special days per month myDiary = new Array(); myDiary[1] = "Pay into bank account"; myDiary[28] = "Invoice customers"; myDiary[14] = "Chase customers for payment"; myDiary[5] = "Top up fuel in generator"; // Work out day number myDate = new Date(); myDay = myDate.getDate(); // Output message of the day document.write(myDiary[myDay]); </SCRIPT> </BODY> </HTML>
See also: | Date.prototype, Date.setDate() |
Prev | Home | Next |
Date.constructor | Up | Date.getDay() |
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. |