Advertisement
saasbook

Fix stupid names

Mar 6th, 2012
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.34 KB | None | 0 0
  1. class DateCalculator
  2.  
  3.   def convert(day)
  4.     year = 1980
  5.     while (days > 365) do
  6.       if (year % 400 == 0 ||
  7.           (year % 4 == 0 && year % 100 == 0))
  8.         if (days > 366)
  9.           days -= 366
  10.           year += 1
  11.         end
  12.       else
  13.         days -= 365
  14.         year += 1
  15.       end
  16.     end
  17.     return year
  18.   end
  19.  
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement