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 8549025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:37:52+00:00 2026-06-11T13:37:52+00:00

I am trying to figure out how to convert a datepart for a week

  • 0

I am trying to figure out how to convert a datepart for a week to the Monday of that week.

I am using this:

     datepart(ww, DateCompleted) as week 

to group a set of orders in our system by week. My goal is for this to say instead of 37, i want it to return the Monday of week 37, i.e.: 09-10-2012. I am able to do this by defining each week per number but i would rather not spend so much time typing out each week when there is probably a better option out there, i have just been unable to find it anywhere online other than in MySQL and other programming languages (i need T-SQL please, or anything that will work on sql server 2005), and i do not know how to work with that. Thanks for anyone that can help. Ill be checking back as often as possible to provide more info if needed.

  • 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-11T13:37:53+00:00Added an answer on June 11, 2026 at 1:37 pm

    of course i found a solution right after posting this, thanks for anyone who looked and tried to help. Here is the solution i found:

    SET DATEFIRST 1
    declare @wk int  set @wk = 1
    declare @yr int  set @yr = 2007
    
    select dateadd (week, @wk, dateadd (year, @yr-1900, 0)) - 4 -
         datepart(dw, dateadd (week, @wk, dateadd (year, @yr-1900, 0)) - 4) + 1
    

    found at this link:

    http://social.msdn.microsoft.com/Forums/en/transactsql/thread/cf233caf-4ccd-4bca-add2-b5eb467f2dd4

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query that i've been trying to figure out how to convert
Hey I'm trying to figure out how to convert a statement that works in
Hi there I'm trying to figure out how to convert this-is-my-slug to: This Is
Trying to figure out the byte[] equivalent of this string getText = string.Empty; using
I was looking at the ImageConverter class, trying to figure out how to convert
Trying to figure out how I can do this properly. The print_r looks like
trying to figure out why this is happening - I have an input text
Trying to figure out how to type (via events not set the value) on
Trying to figure out the best way to set up collection lists for users
I have been trying to figure out a way to convert bitmap files into

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.