Public Function WeekdayMonthAndDayToMatchingYears( _
ByVal vDayOfWeek As Variant _
, ByVal vMonthOfYear As Variant _
, ByVal vDayOfMonth As Variant _
, Optional ByVal vMinYear As Variant _
, Optional ByVal vMaxYear As Variant _
) As Variant
Takes part of a date such as Sun. Feb 15 along with a range of years, then returns a string containing the years in which that date is valid.
Examples: ? WeekdayMonthAndDayToMatchingYears(vbSunday, 1, 1)
1928 1933 1939 1950 1956 1961 1967 1978 1984 1989 1995 2006 2012 2017 2023
? WeekdayMonthAndDayToMatchingYears(vbSunday, 1, 1, 1975, 2025)
1978 1984 1989 1995 2006 2012 2017 2023
? WeekdayMonthAndDayToMatchingYears(#1/21/1978#, 1, 1, 1975, 2025)
1978 1984 1989 1995 2006 2012 2017 2023
? Format$(#1/1/2023#, "ddd")
Sun
See also: vbSunday Property, et. al.
vDayOfWeek: The date or numeric value which specifies the day of the week. Function first checks to see if vDayOfWeek is a date, and if so, it examines the date component of date/time values to determine the weekday. Otherwise, numeric values are assumed to be one of the vb constants that represent the days of the week (vbSunday, vbMonday, vbTuesday, vbWednesday, vbThursday, vbFriday, or vbSaturday). Function returns Null if vDayOfWeek is Null or cannot be fixed up to either a date or a number.
vMonthOfYear: The date or numeric value which specifies the month of the year. Function first checks to see if vMonthOfYear is a date, and if so, it gets the month component of the date/time value. Otherwise, numeric values are assumed to be the number of a month with 1 = January and 12 = December. Function returns Null if vMonthOfYear is Null or cannot be fixed up to either a date or a number.
vDayOfMonth: The date or numeric value which specifies the day of the month. Function first checks to see if vDayOfMonth is a date, and if so, it gets the day component of the date/time value. Otherwise, numeric values are assumed to be the number of a day within a month. Function returns Null if vDayOfMonth is Null or cannot be fixed up to either a date or a number.
vMinYear: The earliest year which is checked for a valid combination of weekday, day, and month occur. Function first checks to see if vMinYear is a date, and if so, it gets the year component of the date/time value. Otherwise, numeric values are assumed to be the number of a year. vMinYear defaults to 1925 if it is missing or Null or cannot be fixed up to a Date or a number.
vMaxYear: The latest year which is checked for a valid combination of weekday, day, and month occur. Function first checks to see if vMaxYear is a date, and if so, it gets the year component of the date/time value. Otherwise, numeric values are assumed to be the number of a year. vMaxYear defaults to 2025 if it is missing or Null or cannot be fixed up to a Date or a number. Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.