@@DATEFIRST – Configuration function

What is  @@DATEFIRST

it is one of the configuration functions returns first day of the week (tinyint) . The U.S. English default is 7, Sunday



  • The language setting affects the interpretation of character strings as they are converted to date values for storage in the database, and the display of date values that are stored in the database.
  • This setting does not affect the storage format of date data.
Where it is used ?

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
It may be confusing   how can  Saturday and Sunday have the same value !
well lets explain that little bit more,  according to the above datefirst value Sunday is considered as first day of the week so SUNDAY -1,MONDAY-2,……..SATURDAY-7
As we just mentioned value of the @@datefirst varies according to the language setting
Lets change the value of  the DATEFIRST  and see what happens when we use the DATEPART

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s