WeekdayName
The WeekdayName function returns the name for the day of the
week. The only required parameter is a Date
or Datetime expression that the function should return
the day of the week for.
The optional second parameter is a boolean which indicates whether the function
should return an abbreviated version of the weekday name (true) or the
full weekday name (false).
An optional third parameter indicates which day represents the first
day-of-the-week. If not supplied, the default will be Sunday.
Valid values you may pass for this parameter are shown in the table below.
| Constant |
Value |
Meaning |
| vbSunday |
1 |
Sunday |
| vbMonday |
2 |
Monday |
| vbTuesday |
3 |
Tuesday |
| vbWednesday |
4 |
Wednesday |
| vbThursday |
5 |
Thursday |
| vbFriday |
6 |
Friday |
| vbSaturday |
7 |
Saturday |
Dim dDate dDate = Now() ' build the weekday based on the default setting
Response.Write "Weekday is: " & Weekday(dDate) & "<BR>" Response.Write "Weekday Name is: " & WeekdayName(dDate) & "<BR>"
' build the weekday based on first day of monday
Response.Write "Weekday is: " & Weekday(dDate, vbMonday) & "<BR>" Response.Write "Weekday Name is: " & WeekdayName(dDate, false, vbMonday) & "<BR>"
This method is very useful for displaying the current day-of-the-week and
also for building a calendar application. You can retrieve individual parts of
a date using the Year, Month and Day functions as well
as the DatePart function.
|
 |

|