GemBox.Spreadsheet

ExcelCell.ConvertExcelNumberToDateTime Method 

Converts Excel floating-point number to DateTime structure.

public static DateTime ConvertExcelNumberToDateTime(
   double num,
   bool use1904DateSystem
);

Parameters

num
Excel floating-point number.
use1904DateSystem
True to use 1904 date system.

Return Value

Converted DateTime structure.

Remarks

Excel file format doesn't have a separate data type for date and time. DateTime value is stored as IEEE number encoded in a special way. When reading Excel file, CellStyle.NumberFormat is examined and if it matches some of date/time number formats cell value is interpreted as DateTime.

However, if some non-standard date/time number format is used, cell value will not be recognized as DateTime but as ordinary number. In such cases (when you know that specific cell holds DateTime value but you get a number when reading Excel file) use this method to convert IEEE number to DateTime structure.

See Also

ExcelCell Class | GemBox.Spreadsheet Namespace