public static double getExcelDate(Date date, boolean use1904windowing) {Calendar calStart = LocaleUtil.getLocaleCalendar();calStart.setTime(date);int year = calStart.get(Calendar.YEAR);int dayOfYear = calStart.get(Calendar.DAY_OF_YEAR);int hour = calStart.get(Calendar.HOUR_OF_DAY);int minute = calStart.get(Calendar.MINUTE);int second = calStart.get(Calendar.SECOND);int milliSecond = calStart.get(Calendar.MILLISECOND);return internalGetExcelDate(year, dayOfYear, hour, minute, second, milliSecond, use1904windowing);}

public static double getExcelDate ( Date date , boolean use1904windowing ) { Calendar calStart = LocaleUtil . getLocaleCalendar ( ) ; calStart . setTime ( date ) ; int year = calStart . get ( Calendar . YEAR ) ; int dayOfYear = calStart . get ( Calendar . DAY_OF_YEAR ) ; int hour = calStart . get ( Calendar . HOUR_OF_DAY ) ; int minute = calStart . get ( Calendar . MINUTE ) ; int second = calStart . get ( Calendar . SECOND ) ; int milliSecond = calStart . get ( Calendar . MILLISECOND ) ; return internalGetExcelDate ( year , dayOfYear , hour , minute , second , milliSecond , use1904windowing ) ; }
public static double GetExcelDate(DateTime date, bool use1904windowing){if ((!use1904windowing && date.Year < 1900)  || (use1904windowing && date.Year < 1904))   {return BAD_DATE;}DateTime startdate;if (use1904windowing){startdate = new DateTime(1904, 1, 1);}else{startdate = new DateTime(1900, 1, 1);}double value = (date - startdate).TotalDays + 1;if (!use1904windowing && value >= 60){value++;}else if (use1904windowing){value--;}return value;}
