Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Date.isleap (See related posts)

Date.isleap = function(year){
 return ((year % 400) == 0) ? 1 :
        ((year % 100) == 0) ? 0 :
        ((year % 4)   == 0) ? 1 :
         0;
}
Date.prototype.isleap = function(){
    return Date.isleap(this.getFullYear())
}
// isleap current year
new Date().isleap()

You need to create an account or log in to post comments to this site.


Click here to browse all 5143 code snippets

Related Posts