Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:27:55+00:00 2026-06-08T09:27:55+00:00

I would like to write a simple SELECT statement in SQL Server 2005 which

  • 0

I would like to write a simple SELECT statement in SQL Server 2005 which does the following computation with date arithmetic:

Starting from the present date (this means getdate()), determine the previous Monday, and then subtract 70 days from that Monday, showing in output the resulting date.

How could I achieve this?

My difficulty is mainly to determine the previous Monday.

Of course, if getdate() is Monday, the previous Monday is getdate()

Thank you in advance for your kind help.

UltraCommit

EDIT: Please note that in Italy the first day of the week is Monday and not Sunday, so if the input is Sunday, July 29th, 2012, the output has to be 23rd July, and not 30th July.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:27:56+00:00Added an answer on June 8, 2026 at 9:27 am

    This will retrieve monday for the current week

    Select DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0)
    

    and then you need to subtract 70 from the above day

    SELECT Dateadd(DAY,-70,DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0))
    

    Edit : Please go through the answer posted in SO

    Monday is displayed as Current Week because DATEFIRST which indicates the 1st day of the week is set to monday .In order to set it to Sunday ,you need to change the setting to Sunday

     Set DATEFIRST 7
    

    Else as suggested in the above SO link ,you need to change your code

     DECLARE @dt DATE = '1905-01-01';
     SELECT [start_of_week] = DATEADD(WEEK, DATEDIFF(WEEK, @dt, CURRENT_TIMESTAMP), @dt);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to write an if statement that would continue to repeat a
I would like to write a query that returns a single date value, that
I would like to write an if statement that will do something base on
I have a simple linq statement that isn't quite returning what I would like.
In MySQL, I have a simple "SELECT * FROM foo" query. I would like
I would like to write nested query with Doctrine; Sample SQL is like below:
I need to write a program that accepts a basic SQL select statement and
I'd like to write an application, which would imitate a player in an online
I would like to write an abstract base class class func_double_double_t : public unary_function<double,
I would like to write a function that creates a plot of a set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.