Hello, I would like to know if a year is a bissextile year or not.
Have you an idea, because i would want to do a modulo to know if year is a divisible by 4 .
Thanks a lot
Hello, I would like to know if a year is a bissextile year or not.
Have you an idea, because i would want to do a modulo to know if year is a divisible by 4 .
Thanks a lot
Hi there,
according to wikipedia (see here)
following should do the trick just fine:
Code:var d=new Date().getFullYear(); var leap=false; if(d%4==0 && d%100!=0 || d%400==0) leap=true;
Last edited by mateuszk; 2010-09-10 at 21:06. Reason: fid509 corrected my error. Thx!
The code must be
if(d%4==0 && d%100!=0 || d%400==0) leap=true;
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks