SQLTeam.com | Weblogs | Forums

Working Day


#1

I'm trying to calculate the current date is working day and if its the 7th working day
also like to see last day of the month(EOMonth) if its working day (Mon-Friday)

[    SELECT 
    DATENAME(DW,GETdate()) AS Day
   ,DATEPART(WEEKDAY, GETdate()) WeekDay
   , DAY(GETdate()) AS DayOfMonth
   ,GETdate()  AS date
     ,EOMONTH(GETdate()) As EndOfMonth
   --CASE WHEN DATEPART(WEEKDAY, GETdate()) NOT IN ( 6, 7 ) and 
    ,CASE 
	      WHEN (DATEPART(WEEKDAY, GETdate()) between '1' and '5')  and  DAY(GETdate())  = 7 Then 
		   'True' 
		  Else 
		    'False' 
	END As If_Wk_Value
   ,CASE WHEN DAY(GETdate()) =  13   Then 'True' Else 'False' END As If_Month_Value

[/quote]

Many thanks
Farhan


#2

what is @@DATEFIRST in your neck of the woods?