How to get first & last day of the previous Week


If you want to get the first day and last day of the last week then you can use the following query.


This query will return first day of the previous Week


SELECT CONVERT(DATE,DATEADD(WK, DATEDIFF(WK, 0, GETDATE()) - 1, 0)) First_Day_Of_Prev_Week

This query will return last day of the previous Week


SELECT CONVERT(DATE,DATEADD(WK, DATEDIFF(WK, 0, GETDATE()) - 1, 0) + 6) Last_Day_OF_Prev_Week


No comments:

Post a Comment

Please do not enter any spam link in the comment box.

NUnit : Introduction

There are several unit test tools in the market, but one of them is NUnit, the most popular tool for doing unit testing. So in this tutorial...