WEEKDAYNAME

WEEKDAYNAME(weekday [,abbreviate] [,firstdayofweek])

Returns the day of the week as a string (String).


weekdayThe numeric designation for the day of the week (Integer).
abbreviate(Optional) Whether the week day name is abbrevated (Boolean):
False = the week day name is not abbreviated (default)
True = the week day name is abbreviated
firstdayofweek(Optional) A vbDayOfWeek constant that specifies the first day of the week (Integer):
0 = vbUseSystemDayOfWeek (default)
1 = vbSunday
2 = vbMonday
3 = vbTuesday
4 = vbWednesday
5 = vbThursday
6 = vbFriday
7 = vbSaturday

REMARKS
* If "abbreviate" = True then the weekday name will be abbreviated to three characters.
* If "abbreviate" = False then the weekday name will not be abbreviated.
* If "abbreviate" is left blank, then False is used.
* If "firstdayofweek" is left blank, then 0 is used.
* If "firstdayofweek" = vbUseSystemDayOfWeek, this takes the setting from the Control Panel, Region.
* Numeric value of each day depends on setting of the firstdayofweek setting.
* You can use the MONTHNAME function to return the day of the month as a string.
* You can use the WEEKDAY function to return the number representing the day of the week for a given date.
* The equivalent .NET function is [[Microsoft.VisualBasic.DateAndTime.WeekdayName]]
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print WeekdayName(1)                                      'Monday  
Debug.Print WeekdayName(1, False) 'Monday
Debug.Print WeekdayName(1, True) 'Mon
Debug.Print WeekdayName(1, , vbDayOfWeek.vbUseSystemDayOfWeek) 'Monday
Debug.Print WeekdayName(1, , vbDayOfWeek.vbMonday) 'Monday
Debug.Print WeekdayName(1, , vbDayOfWeek.vbSunday) 'Sunday
Debug.Print WeekdayName(2) 'Tuesday
Debug.Print WeekdayName(2, True) 'Tue
Debug.Print WeekdayName(2, True, vbDayOfWeek.vbMonday) 'Tue
Debug.Print WeekdayName(2, True, vbDayOfWeek.vbTuesday) 'Wed
Debug.Print WeekdayName(2, True, vbDayOfWeek.vbWednesday) 'Thu
Debug.Print WeekdayName(1, , vbDayOfWeek.vbUseSystemDayOfWeek) 'Monday

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top