Number of Days by Month Report based on Start and End Dates

I have a requirement to generate a report (tabular view) which displays number of days by Month from Start Date to End Date. Also, total number of days that fall in the range in the corresponding year.

I am looking for a Javascript function as a solution to the above requirement but could not find one. Thanks for any help.

For example,
Start Date: 02/15/2007
End Date: 08/22/2010

Report should be as displayed in the attached text file.

It would not be right for us to do your assignment for you.

You have two problems here.

  1. How to get the date information
  2. How to display the information on the page

As far as the date information is concerned, here is the information relating to dates:

You can get the number of days in a certain month, with for example the following:
new Date(year, month, 0).getDate();