Advertisement
Guest User

Date check

a guest
Jan 21st, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.34 KB | None | 0 0
  1. #region
  2.                 {
  3.                     if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) //Months that have 31 days
  4.                     {
  5.                         if (currentDay <= 29)
  6.                         {
  7.                             currentDay += 2;
  8.                         }
  9.                         else
  10.                         {
  11.                             currentDay = dayStart;
  12.                             if (month < 12)
  13.                             {
  14.                                 month++;
  15.                             }
  16.                             else
  17.                             {
  18.                                 month = 1;
  19.                                 realYear++;
  20.                             }
  21.                         }
  22.                     }
  23.                     //Console.Out.WriteLine(currentDay);
  24.                     if (month == 4 || month == 6 || month == 9 || month == 11) //Months that have 30 days
  25.                     {
  26.                         if (currentDay < 28)
  27.                         {
  28.                             currentDay += 2;
  29.                         }
  30.                         else
  31.                         {
  32.                             currentDay = dayStart;
  33.                             if (month < 12)
  34.                             {
  35.                                 month++;
  36.                             }
  37.                             else
  38.                             {
  39.                                 month = 1;
  40.                                 realYear++;
  41.                             }
  42.                         }
  43.                     }
  44.                     if (month == 2) //February
  45.                     {
  46.                         if (realYear % 4 == 0 && realYear != 1900) //Leap Years
  47.                         {
  48.                             if (currentDay < 28)
  49.                             {
  50.                                 currentDay += 2;
  51.                             }
  52.                             else
  53.                             {
  54.                                 currentDay = dayStart;
  55.                                 if (month < 12)
  56.                                 {
  57.                                     month++;
  58.                                 }
  59.                                 else
  60.                                 {
  61.                                     month = 1;
  62.                                     realYear++;
  63.                                 }
  64.                             }
  65.                         }
  66.                         else //Non-leap years
  67.                         {
  68.                             if (currentDay < 26)
  69.                             {
  70.                                 currentDay += 2;
  71.                             }
  72.                             else
  73.                             {
  74.                                 currentDay = dayStart;
  75.                                 if (month < 12)
  76.                                 {
  77.                                     month++;
  78.                                 }
  79.                                 else
  80.                                 {
  81.                                     month = 1;
  82.                                     realYear++;
  83.                                 }
  84.                             }
  85.  
  86.  
  87.                         }
  88.                     }
  89.                 }
  90.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement