Products
Services
Contact Us

Scripts: Javascript :: Date and Time Functions :: Library Article #14

Developer's Section

Get the number of days for any given month
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (1898)
Favorites:

Using javascript we can determine the number of days for any given month and any given year.

Here is a simple script that gives you the number of days of a current month. The function getNumDaysMonth takes as input the year and the month number and returns the current number of days for that particular month. The script itself works by calculating the type of year (leap-year or non-leap year) given a month using the remainder operation. it selects the number of days from several predefined arrays.

Enter Month #
format: 1-12
Enter year
format: YYYY



See other Scripts in Date and Time Functions

 

Submit Your Scripts:

If you would like to have your Javascripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]