This post originated from an RSS feed registered with .NET Buzz
by Richard Jonas.
Original Post: Complete years between 2 dates
Feed Title: Richard Jonas
Feed URL: http://feeds.feedburner.com/blogspot/ouNA
Feed Description: Richard Jonas's blog about .NET, web development and agile methodologies.
A problem we have had calculating ages was due to it using the SQL Server "DateDiff" function. This counts the number of times a day crosses a boundary, e.g.
DateDiff(year,'12/31/2006','1/1/2007') is 1, as it crosses the 2006-2007 boundary.
DateDiff(year,'1/1/2006','12/31/2006') is 0 as it doesn't cross a year boundary.
I have written a function "yeardiff", which calculates the number of...