Quantcast
Channel: SQL Server Reporting Services, Power View 포럼
Viewing all articles
Browse latest Browse all 24955

Date formats and trying to determine 13 months from getdate

$
0
0

Hello,

Back story - we are trying to determine eligibility for 401K and our situation is is if they are hired on the first of the month, they are eligible that month of the following year, but if they were hired after the first they are eligible the next month of the following year:

EX: Hired 01/01/2012 - eligible 01/01/2013

Hired 01/02/2012 - eligible 02/01/2013

So I have the following lines of code:

and datepart(mm,start_date)=DATEPART(mm,getdate())

and datepart(YY,Start_date)=DATEPART(YY,DATEADD(YY,-1,getdate()))

This does return results, but they are not accurate, as the start date is in fact 01/03/2012 - so I have tried to change the second line of code to:

and datepart(YY,START_DATE)=DATEPART(MM,DATEADD(MM,-13,getdate())) but it returns folks with a start date in 01/01/2011, but I want it to show folks with a hire date of 12/02/12 and greater.

Thanks


Viewing all articles
Browse latest Browse all 24955

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>