# How can I Calculate days between 2 dates using a 360 day year. RSS

## 6 replies

Last post Jun 16, 2005 07:26 PM by rayfusion

None

0 Points

21 Posts

### How can I Calculate days between 2 dates using a 360 day year.

I can do this very easy with the datediff("d",date1,date2) function which use 365 days per year. But I want to use the same function that excel uses which is the 360 days per year. Thanks in advance for your help.

Member

72 Points

214 Posts

### Re: How can I Calculate days between 2 dates using a 360 day year.

When you compare two dates and find the difference in the number of days, it doesn't matter how many days are in a year. All that matters is the number of day difference between the dates.
Microsoft MVP - Windows Live Platform
Blog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Bing Maps Control

None

0 Points

21 Posts

### Re: How can I Calculate days between 2 dates using a 360 day year.

That is true. But for purpose of this application, accountants use a 360 day year which is 12 months of 30 days each. Excel has a function for this called Days360. I need to be able to perform the same function in asp.net.

Member

10 Points

708 Posts

### Re: How can I Calculate days between 2 dates using a 360 day year.

Roll your own, I'm afraid.  I think the logic is pretty easy.  Probably a combination of the datediff in months and the day of the month.  Something like 1/1/05, 3/7/05 is 2 months difference (2x30) plus 7-1 = 66 days.  Not sure what to do when you have1/31/05. Put all the possible types of cases in Excel and reverse-engineer its formula.

None

0 Points

21 Posts

### Re: How can I Calculate days between 2 dates using a 360 day year.

Here is the a link for the function. It works like a charm.

http://www.vbcity.com/forums/topic.asp?tid=21264

Member

10 Points

363 Posts

### Re: How can I Calculate days between 2 dates using a 360 day year.

The number of days inbetween two dates will still remain the same .. whether there are 365 or 360 days in a year.

For example, There will always be two days between the 14th and the 16th of any month.

Now, if you need to display that information in Month/Day format , yeah, you would need to create your own formula.

None

0 Points

21 Posts