Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
Access Functions
Subscription

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Access: WeekdayName Function

Print

In Access, the WeekdayName function returns the name of the day of the week corresponding to the date and the first day of the week provided as arguments.

The syntax for the WeekdayName function is:

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

The required argument weekday is a number between 1 and 7 that represent a day of the week. The abbreviate argument is optional. It accepts a boolean value, that indicates if the month name is to be abbreviated. If omitted, the default is False, which means that the month name is not abbreviated. The firstweekday argument is also optional. It determines what day is to be the first day of the week. The following is a list of valid parameters for firstweekday.

Constant Value Description
vbUseSystem 0 Use the NLS API settings
vbSunday 1 Sunday (default used)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday

Examples

WeekdayName (5)                            returns 'Thursday'
WeekdayName (5,True)                     returns 'Thu'
WeekdayName (5,True,5)                  returns 'Mon'
WeekdayName (5,True,vbTuesday)    returns 'Mon'

VBA Code

Dim MyWeekday As Integer 
MyWeekday = WeekdayName(3,False)

This example uses the WeekdayName function to obtain the name of the day of the week.  Now the MyWeekday variable would contain the value of 'Tuesday'.

SQL query

You can also use the WeekdayName function in a query.

SELECT WeekdayName(1,True) AS Expr1
FROM Orders

Note

You cannot test this function online. It works in Access only.




Tags:

Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments





Copyright © 2005-2014             www.WebCheatSheet.com All Rights Reserved.