c# - Calculating a leap year without the leap year function -


i need calculate if current year @ runtime of program leap year (divisible 4, not divisible 100 divisible 400) without using datetime.leapyear property. can suggest anything?

//datetimepicker code

    private void datetimepicker1_valuechanged(object sender, eventargs e)     {         datetime now;         int[] months = {31,28,31,30,31,30,31,31,30,31,30,31};         = datetime.now.date;         if (now.year / 4 == 0 && now.year / 400 == 0)         {             months(1) = 29;         }     } 

i think covers 3 criteria:

var year = now.year;  if (year % 4 == 00 && !(year % 100 == 0 && year % 400 != 0)) {     .... } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -