See also: firstDay

Calculates the date of the last weekday within the month of the year from the passed arguments.

Syntax

JSV_lastDay(expWD, expM, expY)

Prototype

n/a

Returns

The function lastDay returns the date of the last weekday within the month of the year.

Parameters

The lastDay function uses the following arguments.

Argument Description
expWD Weekday of interest. Valid weekday values include:
  • 0 - Sunday
  • 1 - Monday
  • 2 - Tuesday
  • 3 - Wednesday
  • 4 - Thursday
  • 5 - Friday
  • 6 - Saturday
expM Month of interest. Valid months include:
  • 0 - January
  • 1 - February
  • 2 - March
  • 3 - April
  • 4 - May
  • 5 - June
  • 6 - July
  • 7 - August
  • 8 - September
  • 9 - October
  • 10 - November
  • 11 - December
expY Year of interest.

Remarks

n/a

Dependencies

JSV_isLeapYear, JSV_toDate

Example

The following lines of code

var i = 0;
var today = new Date(), year = JSV_getFullYear(today);
document.write( "The last weekdays within " + 
    monthNames[today.getMonth()] + ", " + 
    year + " are:" );
for (i=0; i<7; i++)
    document.write( dayNames[i] + '   ' + JSV_lastDay(i,today.getMonth(),year) );

produce