Is there away to do this in SQL Server Stored Procedure. I am basically trying to determine full datetime pay period base upon date time now for two weeks using the formula below. It works in code. But I need to do it in a query for a filter purpose. The payperiod variable is 14 days.
TimeSpan ts = DateTime.Today - baseDate;
int numOfDaysDiff = ts.Days;
int numOfBiWeeks = numOfDaysDiff / Properties.Settings.Default.PayPeriodDays;
periodStart = baseDate.AddDays(numOfBiWeeks * Properties.Settings.Default.PayPeriodDays);
periodEnd = periodStart.AddDays(Properties.Settings.Default.PayPeriodDays - 1);
Hitesh PatilPosted Dec 11, 2015, 8:27 AM
http://thereferraltask.net/?ref109534