protected static int getDayNumber(int date) {
		int dayNumber = 0;
		int year = 0;
		int month = 0;
		int day = 0;
		boolean isLeapYear = false;
		int[] monthLengthStandard = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		
		//break date into pieces
		day = date % 100;
		month = (int) (date % 10000) / 100;
		year = (int) date / 10000;

		//check for leapyear
		if((year % 400) == 0)
		   isLeapYear = true;
		else if ((year % 100) == 0)
		   isLeapYear = false;
		else if((year % 4) == 0)
		   isLeapYear = true;
		else
		   isLeapYear = false;
		
		//calculate day of the year
		dayNumber = day;
		for(int i = 0; i < month - 1; i++) {
			dayNumber += monthLengthStandard[i];
		}
		if(isLeapYear && month > 2) //add leap year day 
			dayNumber++;
		return dayNumber;
	}