Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Difference between two dates ignoring the year - SQL 2008 R2

$
0
0
Hi
I have a date field in the database called cutoffdate. The table name is Paydate. The cutoffdate is as shown below:

CutoffDate

2013-01-11 00:00:00.000

2013-02-11 00:00:00.000

2013-03-11 00:00:00.000

2013-04-11 00:00:00.000

2013-05-11 00:00:00.000

2013-06-11 00:00:00.000

2013-07-11 00:00:00.000

2013-08-11 00:00:00.000

2013-09-11 00:00:00.000

2013-10-11 00:00:00.000

2013-11-11 00:00:00.000

2013-12-11 00:00:00.000

I want to compare the current date with the cutoffdate (any of the 12 dates above) and then if the difference is 2 days, I need to proceed further.
This cutoffdate will remain same next year and the year after. so i need to compare the date ignoring the year part. For example if the system date is 2013-11-09, then it should come up as 2 days. Also if the system date is 2014-11-09, then it should show as 2 days. How can this be achieved? Please help

Viewing all articles
Browse latest Browse all 23857

Trending Articles



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