You are here: Function Reference > Alphabetical Listing > W > WeekDay

WeekDay

Use this function to determine the day of the week in a given date and return the value as a number.

Syntax

WeekDay (Date, Format, Locale)

Parameter

Description

Date

Enter a valid date string. The system assumes your entry is in the format specified by the Format parameter. The default is the current date.

Format

Enter a valid date format that describes the format used by your entry in the Date parameter. The default is date format 1 (MM/DD/YY).

Locale

(Optional) Enter the locale code. If you omit this parameter, the system checks the Locale INI option. If the Locale INI option offers no value, the system defaults to USD (United States/English).

The system returns the number of the day of the week, from 1 to 7, as shown here:

Number

Day of the week

1

Sunday

2

Monday

3

Tuesday

4

Wednesday

5

Thursday

6

Friday

7

Saturday

WeekDay is most often used with the DayName function. The DayName function extracts the name of the day of the week from a given date.

Example

Here are some examples:

(Assume the current date is Wednesday, July 5, 2009.)

Function

Result

Explanation

WeekDay ( )

4

Defaults to the current date.

Datestring =

DateAdd( , , 1);

WeekDay(datestring)

5

First the DateAdd function adds one day to the current date, resulting in a date of Thursday, July 6, 2009. Then WeekDay returns 5, which corresponds to Thursday.

See also