private static int MonthFromTime(double time){
int month = 0;
int day = DayWithinYear(time)+1;
if (InLeapYear(YearFromTime(time)))
while (day > leapDaysToMonthEnd[month]) month++;
else
while (day > daysToMonthEnd[month]) month++;
return month;
}