Find Second Saturday of Month

  • HI,

    How to find

    a) Second Saturday of the current month,

    b) Given date is second Saturday or not.

    Please help me.

    Regards,

    Santosh

  • HI,

    Thank you for ur quick reply,

    I gone through the given link, it gives us the no.of days,

    for the given date range,

    but

    What exactly i want is,

    Whether the given date is Second Saturday or not.

    Regards,

    Santosh

  • Just go from there... don't know how you need to use it, so here it goes :

    --Make sure Saturday is the 7th day of the week on your server as well

    DECLARE @MyDate AS DATETIME

    SET @MyDate = '2008-09-13'

    --PRINT DATEPART(dd, @MyDate)

    --PRINT DATEPART(dw,@MyDate)

    IF (DATEPART(dw,@MyDate) = 7 AND DATEPART(dd, @MyDate) BETWEEN 8 AND 14 )

    SELECT 'yup'

    ELSE

    SELECT 'nope'

  • hi,

    thank you very much,

    this is what exactly i need,

    i am calculating the business hours between two days based on shifts using function,

    there i need to eliminate the second saturday's as of the requirement

    in that function, i am the date is second saturday or not, i need a just line of code to include in that function

    " DATEPART(dw,@MyDate) = 7 AND DATEPART(dd, @MyDate) BETWEEN 8 AND 14 "

    I am using different logic which is not working fine always,,,,

    thank you very much again

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply