Click or drag to resize

ExcelCellConvertExcelNumberToDateTime Method

Converts Excel floating-point number to DateTime structure.

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version:
public static DateTime ConvertExcelNumberToDateTime(
	double num,
	bool use1904DateSystem


Type: SystemDouble
Excel floating-point number.
Type: SystemBoolean
True to use 1904 date system.

Return Value

Type: DateTime
Converted DateTime structure.

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