How can I tell if a year is a leap year in JavaScript?
Last edited by The Hobo; Apr 29th, 2003 at 04:44 PM.
My evil laugh has a squeak in it. kristopherwilson.com
Assuming year is an integer value: Code: if (year % 4 == 0 && (!(year % 100 == 0) || year % 400 == 0)) { //Leap year } else { //No leap year }
if (year % 4 == 0 && (!(year % 100 == 0) || year % 400 == 0)) { //Leap year } else { //No leap year }
Thanks.
Forum Rules