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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:10:32+00:00 2026-05-16T11:10:32+00:00

I have an @StartDate and @EndDate. I need the @StartDate to be the day

  • 0

I have an @StartDate and @EndDate.

I need the @StartDate to be the day the query is ran(which will always be the first of the month) and the @EndDate to be exaclty at the end of the month no matter if the month is 30 or 31 days, etc.

  • 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-05-16T11:10:32+00:00Added an answer on May 16, 2026 at 11:10 am

    A worked example:

    DECLARE @StartDate DATETIME, @EndDate DATETIME
    
    SET @StartDate = '2010-01-01 00:00:00.000'
    SET @EndDate = DATEADD(m, 1, @StartDate)
    
    SELECT @StartDate, @EndDate - 1
    

    Basically you want to take the start date, add one month (that’s what the DATEADD is doing), and then deduct one day.

    The output from that query is:

    StartOfMonth            EndOfMonth
    ----------------------- -----------------------
    2010-01-01 00:00:00.000 2010-01-31 00:00:00.000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have start date and end date. I need to find out the day
I have this in some WSDL: <element name="startDate" type="xsd:dateTime"/> <element name="endDate" type="xsd:dateTime"/> Which results
I have a DataTable which has the following structure. StartDate (Type DateTime) EndDate (Type
I need a query in SQL. If I have two columns STARTDATE and END_DATE
I have an XML with datetime data: <A> <StartDate>2011-11-01T00:00:00</StartDate> <EndDate>2011-11-30T00:00:00</EndDate> <IsRecurring>false</IsRecurring> </A> I need
I have the following id eventid startdate enddate 1 1 2009-01-03 2009-01-05 1 2
Hi I have following data in the table: ID-----startDate----endDate 5549 2008-05-01 4712-12-31 5567 2008-04-17
I have two DateTime objects: StartDate and EndDate . I want to make sure
I have a event table that has the following columns: StartDate datetime EndDate datetime
Input @StartDate = '01/25/2010' @EndDate = '02/06/2010' I have 2 CTEs in a stored

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.