Calculates the 1st, 2nd, 3rd, 4th, 5th weekday of any month from the passed arguments.
JSV_nthDay(nth, expWD, expM, expY)
n/a
The function nthDay returns the date of the nth weekday within the month of the year. If the date exceeds the last date of the month, nthDay returns 0.
The nthDay function uses the following arguments.
Argument | Description |
nth | Value from 1 to 5. This value represents the 1st, 2nd, 3rd, 4th, or 5th weekday of interest. |
expWD |
Weekday of interest. Valid weekday values include:
|
expM |
Month of interest. Valid months include:
|
expY | Year of interest. |
n/a
The following lines of code
var i = 0;
var today = new Date(),
year = JSV_getFullYear(today),
month = today.getMonth(),
day = today.getDay();
document.write( "For " + monthNames[month] + " " + year + ":");
document.write( "The 1st " + dayNames[day] + " is " + JSV_nthDay(1,day,month,year) );
document.write( "The 2nd " + dayNames[day] + " is " + JSV_nthDay(2,day,month,year) );
document.write( "The 3rd " + dayNames[day] + " is " + JSV_nthDay(3,day,month,year) );
document.write( "The 4th " + dayNames[day] + " is " + JSV_nthDay(4,day,month,year) );
document.write( "The 5th " + dayNames[day] + " is " + JSV_nthDay(5,day,month,year) );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.