protected Calendar absoluteToGregorian(int date){
		Calendar calendar = Calendar.getInstance();
		int d0 = date - 1;
		int n400 = d0 / 146097;
		int d1 = d0 % 146097;
		int n100 = d1 / 36524;
		int d2 = d1 % 36524;
		int n4 = d2 / 1461;
		int d3 = d2 % 1461;
		int n1 = d3 / 365;
//		int dd = (d3 % 365) + 1;
		int yy = ((400 * n400) + (100 * n100) + (n4 * 4) + n1);
		if ((n100 == 4) || (n1 == 4)){
			calendar.set(Calendar.YEAR, yy);
			calendar.set(Calendar.MONTH, Calendar.DECEMBER);
			calendar.set(Calendar.DAY_OF_MONTH, 31);
		}else{
			yy=yy+1;
			int mm = 1;
			while(date >= gregorianToAbsolute (yy,mm, 1)){
				mm+=1;
			}
			int d=gregorianToAbsolute (yy, mm-1, 1);
			calendar.set(Calendar.YEAR, yy);
			calendar.set(Calendar.MONTH, mm-2);
			calendar.set(Calendar.DAY_OF_MONTH, date-d+1);
		}
		//Set time
		for (int i = AM_PM; i < FIELD_COUNT; i++) {
			calendar.set(i, fields[i]);
		}
		return calendar;
	}