tanj1035
asked on
first day & last day of previous week sql query
Hi Experts,
I want to get the first day and last day of previous week.
For example, today is June 2, the first day of previous week is MAY 25, last day is May 31
First day: Select dateadd(wk, datediff(wk, 0, getdate()) - 1, 0)
Last day: ??
Thanks!
I want to get the first day and last day of previous week.
For example, today is June 2, the first day of previous week is MAY 25, last day is May 31
First day: Select dateadd(wk, datediff(wk, 0, getdate()) - 1, 0)
Last day: ??
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sure. Last day would be:
DATEADD(wk, DATEDIFF(wk, 0, getdate()), 0) - 1
ASKER
Your query is dynamic for any dates.
I am currently looking for a simple query , like First day: Select dateadd(wk, datediff(wk, 0, getdate()) - 1, 0). But I do not know the query for the last day of previous week. Can you help me on it?
Thanks