I have following seed input data:
- Payperiod start: Dec 3rd
- Payperiod end: Dec 16
Thats just example how company payroll goes.
Now, I have just 1 date input, for example 12/30 (as today)
I need to output date range for current pay period which will be: Dec 17 to Dec 30
And, same thing if I input Jan 3 – I should get back Dec 31 to Jan 13 2012
Is there any shortcut in T-SQL or I have to do loops?
EDIT: To summarize question. if we know when pay cycle starts (in past) – how do I figure pay period start for given date?
You need some modulo operations and
DATEDIFF.Gives output
and