Hi friends,
please give me an idea on how to design working day details. In my task I want to create table for working days to school. this days except with general holidays and sunday as a holiday. i searched for this in google but i didnt get what i want. please help me and let me know any articles related with this title.
thanks in advance
Loading
Akkiraju IvaturiPosted Aug 24, 2012, 10:25 PM
DECLARE @DateOld datetime, @DateNew datetimeSET @DateOld = '10-Sep-2005'SET @DateNew = GETDATE()
SET DATEFIRST 1
SELECT DATEDIFF (day, @DateOld, @DateNew) - (2 * DATEDIFF(week, @DateOld, @DateNew)) - CASE WHEN DATEPART(weekday, @DateOld + @@DATEFIRST) = 1 THEN 1 ELSE 0 END - CASE WHEN DATEPART(weekday, @DateNew + @@DATEFIRST) = 1 THEN 1 ELSE 0 END
Javeed M ShaikhPosted Aug 24, 2012, 4:30 PM
DateTime dt = new Datetime(today);
if (dt.DayOfWeek == DayOfWeek.Thursday Or dt.DayOfWeek == DayOfWeek.Monday ......)
{
// it is working day
}
else
{
// it is a holiday
}
also in SQL Server