It is quite handy to have a function that can tell you how many days there are in February due to the leap year shift of either 28 or 29 days.
Below is a function created in Javascript to return the exact amount of days according to the year given:

function daysInFebruary (year){
    return (((year%4==0)&&((!(year%100==0))||(year%400==0)))?29:28);
}
Categories: ContentGeneral

Leave a Reply

Your email address will not be published. Required fields are marked *