See also: lastDay

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

Syntax

JSV_firstDay(expWD, expM, expY)

Prototype

n/a

Returns

The function firstDay returns the date of the first weekday within the month of the year.

Parameters

The firstDay 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_toDate

Example

The following lines of code

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

produce