/ Published in: ASP
URL: http://reusablecode.blogspot.com/2008/11/nth-day.html
Expand |
Embed | Plain Text
<% ' Returns the date of the Nth day for a given month in a given year. function nthDay(someYear, someMonth, someWeek, someWeekday) dim firstDay dim someDay firstDay = weekday(dateSerial(someYear, someMonth, 1)) ' Check if the week day of the first day of the month is before or after the given week day. if (someWeekday - firstDay) >= 0 then someDay = 1 + (someWeekday - firstDay) + ((someWeek - 1) * 7) else someDay = 1 + (someWeekday - firstDay) + (someWeek * 7) end if nthDay = dateSerial(someYear, someMonth, someDay) end function %>
You need to login to post a comment.
