SET DATEFIRST#

Sets the first day of the week to a number from 1 through 7.

Always uses Sunday as the first day of the week.

Syntax#

SET DATEFIRST { number | @number_var } [;]

Arguments#

number | @number_var

Is an integer that indicates the first day of the week. It can be one of the following values.

Value

First day of the week is

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

7 (default, U.S. English)

Sunday

Remarks#

To see the current setting of SET DATEFIRST, use the @@DATEFIRST function.

The setting of SET DATEFIRST is set at execute or run time and not at parse time.

Specifying SET DATEFIRST has no effect on DATEDIFF which always uses Sunday as the first day of the week to ensure the function is deterministic.

Permissions#

Requires membership in the public role.

See Also#