MonthName( ), WeekDayName( ) and WeekDay( )
Just like the DatePart() function, these functions are given a date value and they return part of the date. The difference is that these functions are more specialized than the DatePart() function.
The MonthName() function is passed a number representing the month and it returns the name of the month fully spelled out. There is an optional second parameter that lets you specify whether it should be abbreviated to three letters. Pass True to the second parameter to get the abbreviated name. By default, this is False and it returns the full name.
The WeekDayName() function is passed a number representing the day of the week and it returns the name of the day fully spelled out. Just like MonthName(), you can pass True to the optional second parameter to get the 3 letter abbreviation.
The WeekDay() function is passed a date and it returns a number.
Both the WeekDayName() and WeekDay() functions use a number to represent the day of the week. By default, this number is a 1 for Sunday and a 7 for Saturday. As discussed for the DatePart() function, you can shift this number by specifying a different first day of the week. If you passed crMonday to the function, Sunday is represented by a 7. You pass this as the third parameter for the WeekDayName() function and as the second parameter for the WeekDay() function.
‘Demonstrate using the first day of the week parameter
Formula = WeekDayName(2, True, crMonday) ‘Returns "Tue" for Tuesday
Formula = WeekDay(#1/6/2002#, crMonday) ‘Returns 7 b/c it is a Sunday