In some case for some financial instruments the difference between two dates has to be calculated in a special way...Not on a real 365-6 year, but on a financial constant year of 360 days. It means that in this case each month has 30 days (30days*12months=360days). The function to perform this calculation exist in Excel (DAYS360), but its not so comfortable to use it. So I preferred to create my personal formula...
Which is the trick?
It's very easy to understand the concept behind... You have to consider that an year is composed by 365.2422 days. It means that every 4 year a LEAP year happens. The financial year is of 360 days. The delta is of 5.2422 days. In this way you can perform the normal date difference calculation and the result has to be multiplied for the conversion factor that reduce a normal day to a day of an year 360 days long. In practice the calculation has to be 5.2422/365=0.985637808219178 (conversion factor).
Private Const Days360ConversionFactor As Double = 0.985637808219178
Now the only action you have to do is to keep the calculated usual date difference
Dim</FONT> DifferenceInDaysValue As Double = Me.EndPeriodDate.Value.Subtract(Me.StartPeriodDate.Value).Days
and multiply it per the conversion factor (that couls be assumed to be a constant).
This code could be easy implemented into a class or better into a financial dll to improve its reusability and deployment...
Now the DAYS360 exist also in Visual Studio .NET!!!