SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Farmington
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.
    Attached Files Attached Files

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by vayumahesh View Post
    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:
    https://developer.mozilla.org/en/Jav...l_objects/date

    You can get the number of days in a certain month, with for example the following:
    new Date(year, month, 0).getDate();
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •