August 6, 2008 at 9:43 am
How can i set up a date to show what the date + 30 is and if that date is not the first of the month to give me the next month's first date
the situation is employees are elgible for benefits 30 days after they are hired, and
hire + 30 and then the first of the next month right?
So If say someone is hired on the 10th of august they actually will not be eligible until October 1.
i have a select statement to get the hire date how can i implement this into that
select hiredate from employees where id=@id
August 6, 2008 at 10:02 am
declare @DHire datetime
select @dhire = '6/2/2008'
select
case
when datepart(day, @dhire+30) = 1 then @dhire + 30
else dateadd(day, -1 * datepart(day, @dhire+30), dateadd(month, 1, @dhire+30))+1
end
Test it with a few dates. Should give you what you need.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 6, 2008 at 11:16 am
that did it thanks
August 6, 2008 at 12:29 pm
Just to be sure, does this mean anyone hired in February isn't eligible for benefits until 4/1?
😎
August 6, 2008 at 12:35 pm
yep 30 days is 30 days
good thought though
August 6, 2008 at 12:38 pm
Lynn Pettis (8/6/2008)
Just to be sure, does this mean anyone hired in February isn't eligible for benefits until 4/1?😎
Last company I worked for based its time-off policy on Jan 1, and on how many years you had worked there. An employee, hired on 2 Jan, got a full week less of paid time off than someone hired 2 days earlier. Similar policy on a lot of other stuff.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 6, 2008 at 12:52 pm
With the exception of 1 company (2 if you include pre-existing conditions), I (and my family) have been eligible for benefits from date of hire (first deduction for benefits was for 2 months, month hired and the following month), and vacation was prorated during the first year, but increments were based on anniversary of date of hire. The credit union I worked at, it was 90 days (had to make through your probationary period) for benefits.
😎
August 7, 2008 at 11:07 am
Yeah, it all depends on the company.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply