Method Date.isLeapYear
Check whether a date belongs to a leap year.
-
Syntax
Boolean Date.isLeapYear([ Boolean utc ])
Ifutcis true then calculations are based on UTC time. If flase then the local time is used. -
Parameters
Boolean utc(Optional)- Set to true to use UTC; false to use local time
- Return value True if year of date is a leap year; otherwise false.
-
Examples
- 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();
- Related Date.format
- Resources There is a lengthy article on leap years at Wikipedia.org
-
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
