Bilgin's Blog
Crumpler Wee Bee

 


My Crumpler Wee Bee


For my quest of the ideal notebook bag and my review of Crumpler Wee Bee, click

Wee Bee review

Bicycle in January

 

Bicycle in January

Impressions from a bicycle tour on a warm January Sunday (!). On the bicycle routes of Istanbul and Bagdat Caddesi.

Bicycle in January

Programmers' Blog
Programmer's Blog

Specific hints and tricks for C# programmers.

click for "Programmers' Blog"

DAYS360 Function
Minimize

I know that this is not a mainstream issue, but those who are familiar with Excel's DAYS360 function would know this problem.

Shortly, "DAYS360" is an Excel function that calculates the number of days between two dates, regarding that each month is composed of 30 days. This feature is generally used in financial markets.

While I was dealing with Bloomberg API integration with a C# code, I faced the problem. One of my friends shared his formula of calculating the correct interval. This is the way Bloomberg system calculates DAYS360 style date intervals :

        public static int CalculateDays360(DateTime d1, DateTime d2)
        {
            
int years d2.Year - d1.Year;
            int 
months d2.Month - d1.Month;
            
            int 
dayNo1 0;
            int 
dayNo2 0;

            
dayNo2 d2.Day;
            
dayNo1 d1.Day;


Bilgin Esme, Jun 2008
About  |  Affiliate Program  |  Sitemap  |  FAQ's Privacy Statement  |  Terms Of Use
Copyright 2009 by Bilgin Esme