Click here to Skip to main content
Click here to Skip to main content

Calculate Financial days between dates

By , 13 Sep 2006
 

Introduction

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!!!

¦-D

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

CresciF
Software Developer (Senior)
Switzerland Switzerland
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalfebmemberswapnamurrey28 Feb '07 - 1:02 
this function does not taking 30 days in feb.
suppose iwant to calculte difference between 01/feb/2007 to 08/july/2007
using the Financial 360/360 year
feb 29 days
march 30 days
aprial 30days
may 30days
june 30days
july 8days
total---- 157 days
but using this function it returns 154.745135890410946
Please check once

 
konda
Generaldaycount conventionsmemberStefano Guazzi19 Sep '06 - 4:48 
The DAYS360 formula in Excel computes the number of conventional days between two dates under the 30/360 daycount convention[^], while your code only computes a rough approximation of it. Are you aware of this?
GeneralMinor CorrectionmemberMackay_S18 Sep '06 - 14:02 
Your formula to calculate the conversion factor should read
 
360/365.2422 = .......

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 13 Sep 2006
Article Copyright 2006 by CresciF
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid