/** * @param dateFormat pass <code>null</code> for default YYYYMMDD * @return <code>null</code> if timeStr is <code>null</code> */ private static Double ConvertDate(String dateStr, SimpleDateFormat dateFormat) { if (dateStr == null) { return(Double.NaN); } DateTime dateVal; if (dateFormat == null) { dateVal = HSSFDateUtil.ParseYYYYMMDDDate(dateStr); } else { try { dateVal = DateTime.Parse(dateStr, CultureInfo.CurrentCulture); } catch (FormatException e) { throw new InvalidOperationException("Failed to parse date '" + dateStr + "' using specified format '" + dateFormat + "'", e); } } return(HSSFDateUtil.GetExcelDate(dateVal)); }
/** * @return <code>null</code> if timeStr is <code>null</code> */ private static Double ConvertTime(String timeStr) { if (timeStr == null) { return(Double.NaN); } return(HSSFDateUtil.ConvertTime(timeStr)); }