cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FrankT
Advocate I
Advocate I

Date.DayOfWeek - Default for argument firstDayOfWeek ???

According to the documentation the default for the argument firstDayOfWeek should be Day.Sunday!

 

October 31st, 2010 was a Sunday but Date.DayOfWeek(#date(2010,10,31)) returns 6.

Has this argument somehow been localized? Here in Germany the week starts on Monday, thus 6 would correctly represent a Sunday for Day.Monday.

 

 

Date.DayOfWeek(dateTime as any, optional firstDayOfWeek as nullable number) as nullable number


Returns a number between 0 and 6 representing the day of the week in the provided datetime value dateTime. This function takes an optional Day value, firstDayOfWeek, to set the first day of the week for this relative calculation. The default value firstDay is Day.Sunday. Valid values are: Day.Sunday, Day.Monday, Day.Tuesday, Day.Wednesday, Day.Thursday, Day.Friday, and Day.Saturday.
  • dateTime: A date, datetime, or datetimezone value from which the day of the week is determined.

  • firstDayOfWeek: A Day type representing the first day of the week for this calculation.

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

The documentation is incorrect.

 

It is the first day of the week according to your regional settings in Windows.

 

You may consider always specifying the first day of the week instead of relying on the default.

 

Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
Redoute
New Member

= Date.DayOfWeek(#date(2018, 10, 23)) = Day.Monday

TRUE

 

And I thought it is tuesday already Smiley Sad

MarcelBeug
Community Champion
Community Champion

The documentation is incorrect.

 

It is the first day of the week according to your regional settings in Windows.

 

You may consider always specifying the first day of the week instead of relying on the default.

 

Specializing in Power Query Formula Language (M)

View solution in original post

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors