I would like to check if a given date is the first, second, third, fourth or last monday, tuesday, wednesday,…, sunday in the dates month.
The function should look like this:
if(checkdate(date, "second", "monday"))
{
alert("This is the second monday of the month");
}
else
{
alert("This is NOT the second monday of the month");
}
I would rather write a function that returns an object telling me the day and the week-number-in-month of the given date. Something like:
Then I can read the returned object and find out if it’s the second monday or whatever:
Of course, you can still write another localized function that does exactly what you ask for based on an array of numeral and day names.