public static Date parseDate(String date) {
		int indexOf = date.indexOf('.');
		int lastIndexOf = date.lastIndexOf('.');
		Calendar calendar = Calendar.getInstance();
		int dayOfMonth=0, month=0, year=0;
		int hours = 0;
		int minutes = 0;
		
		if(date.length() < 8) {
			return new Date();
		}
		try {
			if(indexOf == lastIndexOf) {
				indexOf = date.indexOf('-');
				lastIndexOf = date.lastIndexOf('-');
				if(indexOf == lastIndexOf) {
					//parse yyyyMMddThhmm
					dayOfMonth = Integer.parseInt(date.substring(6, 8));
					month = Integer.parseInt(date.substring(4, 6)) - 1;
					year = Integer.parseInt(date.substring(0, 4));
					indexOf = date.indexOf("T"); 
					if(indexOf != -1) {
						hours = Integer.parseInt(date.substring(9 , 11));
						minutes = Integer.parseInt(date.substring(11 , 13));
					}
				} else {
					//parse  yyyy-MM-dd
					year = Integer.parseInt(date.substring(0, indexOf));
					month = Integer.parseInt(date.substring(indexOf+ 1, indexOf+ 3)) - 1;
					dayOfMonth = Integer.parseInt(date.substring(indexOf+4, indexOf+6));
					
					int indexOfT = date.indexOf("T"); 
					if(indexOfT != -1) {
						//parse yyyy-MM-ddThh:mm 						
						hours = Integer.parseInt(date.substring(11 , 13));
						minutes = Integer.parseInt(date.substring(14 , 16));
					}
				}
			} else if (indexOf == 2) {		
				dayOfMonth = Integer.parseInt(date.substring(0, indexOf));
				month = Integer.parseInt(date.substring(indexOf+ 1, lastIndexOf)) - 1;
				year = Integer.parseInt(date.substring(lastIndexOf+1, lastIndexOf+5));
			} else if(indexOf == 4) {
//				logger.debug(date);
//				logger.debug("month: "+Integer.parseInt(date.substring(indexOf + 1, lastIndexOf)));
				year = Integer.parseInt(date.substring(0, indexOf));
				month = Integer.parseInt(date.substring(indexOf + 1, lastIndexOf)) - 1;
				dayOfMonth = Integer.parseInt(date.substring(lastIndexOf+1, lastIndexOf+3));
			}
		} catch (Exception e) {
			logger.error(e, "parseDate: " + date);
		}
		
		calendar.set(Calendar.YEAR, year);
		calendar.set(Calendar.MONTH, month);
		calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
		calendar.set(Calendar.HOUR_OF_DAY, hours);
		calendar.set(Calendar.MINUTE, minutes);
		
		return calendar.getTime();
	}