Check for Leap Year
General
This snippet will check whether a date belongs to a leap year. Easy to add to an existing script.
Notes
- Created by: The JSLab Team, Tavs Dokkedahl
- Web Site: http://www.jslab.dk/
- Posted: April 21, 2008
To check whether 1981 is a leap year (it is not)
// Create a new date var d = new Date(); // Set the year d.setFullYear(1981); // Output is false d.isLeapYear();
Source Code
Paste this source code into the designated areas.
Head
Paste this code into the HEAD section of your HTML document.


Leave a Response
(0 comments)