I am trying to create a report with Monday the first day of the week, and Sunday the last day of the week.
CONVERT (varchar (10),(DATEADD ( d, 2-DATEPART (dw, Evaluations.Quality_Date), Evaluations.Quality_Date )),111)
What this does is show the week starting on Monday. Usually this was fine, except now I have people working on Sundays, and these days are showing up for the week before.
For example, one week starts on Monday, Jan. 30. My report shows Jan 30th, but when I look at the days that go into that week, it shows Jan. 29 as part of the week of Jan. 30th, instead of being part of the week of Jan 23. Can you help me with this?
This is actually a Microsoft SQL Server code example.
In Oracle, you use the NLS_TERRITORY parameter to set which day the week should start on. You can change it just for your session, e.g.:
ALTER SESSION SET NLS_TERRITORY=German;
Then Monday becomes the first day of the week.
Microsoft has its own method of controlling regional and globalization settings.
This was first published in February 2012