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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:43:58+00:00 2026-05-24T15:43:58+00:00

How to get Saturday’s Date. I have today’s date with me. GETDATE() How to

  • 0

How to get Saturday’s Date. I have today’s date with me.

GETDATE()

How to do this.

For eg. TODAY is 08-08-2011

I want output as 08-13-2011

  • 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-24T15:43:59+00:00Added an answer on May 24, 2026 at 3:43 pm

    This is a function that will return the next Saturday if you call it like this:

    SELECT dbo.fn_Get_NextWeekDay('2011-08-08', 6)
    

    The “6” comes from the list of possible values you can set for DATEFIRST.

    You can get any other day of the week by changing the second parameter accordingly.

    This is the function:

    IF OBJECT_ID('dbo.fn_Get_NextWeekDay') IS NOT NULL 
      DROP FUNCTION dbo.fn_Get_NextWeekDay
    GO
    CREATE FUNCTION dbo.fn_Get_NextWeekDay(
         @aDate   DATETIME
       , @dayofweek      INT
        /*
          @dw - day of the week
          1 - Monday
          2 - Tuesday
          3 - Wednesday
          4 - Thursday
          5 - Friday
          6 - Saturday
          7 - Sunday
        */   
      )
    RETURNS DATETIME 
    AS
    /*
      SELECT dbo.fn_Get_NextWeekDay('2011-08-08', 6)
      SELECT dbo.fn_Get_NextWeekDay('2011-08-08', 1)
    */
    BEGIN
      RETURN 
          DATEADD(day
            , ( @dayofweek + 8 - DATEPART(dw, @aDate) - @@DATEFIRST ) % 7
            , @aDate 
          )  
    END
    GO
    

    [EDIT]
    This might be another solution. This should work in any language:

    IF OBJECT_ID('dbo.fn_NextWeekDay') IS NOT NULL 
      DROP FUNCTION dbo.fn_NextWeekDay
    GO
    CREATE FUNCTION dbo.fn_NextWeekDay(
         @aDate     DATE
       , @dayofweek NVARCHAR(30)
      )
    RETURNS DATE
    AS
    /*
      SELECT dbo.fn_NextWeekDay('2016-12-14', 'fri')
      SELECT dbo.fn_NextWeekDay('2016-03-15', 'mon')
    */
    BEGIN
      DECLARE @dx INT = 6
      WHILE UPPER(DATENAME(weekday,@aDate)) NOT LIKE UPPER(@dayofweek) + '%'
      BEGIN
    
        SET @aDate = DATEADD(day,1,@aDate)
    
        SET @dx=@dx-1
        if @dx < 0 
        BEGIN
          SET @aDate = NULL 
          BREAK
        END
      END
    
      RETURN @aDate
    
    END
    GO
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to get Date format like this? Saturday,Dec 11,2011 Edited: My code portion is
I have date string 18-2-2012 , from this how to get the current day
I have this simple code: SimpleDateFormat format = new SimpleDateFormat(yyyy-MM-dd); Date date = format.parse(2011-10-29);
I want to get the Sunday & Saturday of the week from which a
In a datechooser component i want to get the all date values of a
I just want the date to show up like so: Saturday, May 26, 2012
How would you get the date of the the first saturday that occurs after
I want to get the result from the below table like this ..., Expected
Today is Tuesday, February 9, 2010 and when I print the date I get
How to get saturday and sunday dates from given date range. for example :

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.