NanoXLSX Library Documentation
NanoXLSX Library Documentation
NanoXLSX
NanoXLSX
Utils Class
Utils Methods
GeneratePasswordHash Method
GetDateFromOA Method
GetInternalColumnWidth Method
GetInternalPaneSplitHeight Method
GetInternalPaneSplitWidth Method
GetInternalRowHeight Method
GetOADateTime Method
GetOADateTimeString Method
GetOATime Method
GetOATimeString Method
GetPaneSplitHeight Method
GetPaneSplitWidth Method
ToString Method
ToUpper Method
Utils
.
Get
OADate
Time
String Method
Method to convert a date or date and time into the internal Excel time format (OAdate)
Namespace:
NanoXLSX
Assembly:
NanoXLSX (in NanoXLSX.dll) Version: 2.6.2+7f12a949130e0be1e987e553d2d08c083176cdca
Syntax
C#
Copy
public
static
string
GetOADateTimeString
(
DateTime
date
)
Parameters
date
DateTime
Date to process
Return Value
String
Date or date and time as number string
Exceptions
Exception
Condition
FormatException
Throws a FormatException if the passed date cannot be translated to the OADate format
Remarks
Excel assumes wrongly that the year 1900 is a leap year. There is a gap of 1.0 between 1900-02-28 and 1900-03-01. This method corrects all dates from the first valid date (1900-01-01) to 1900-03-01. However, Excel displays the minimum valid date as 1900-01-00, although 0 is not a valid description for a day of month. In conformance to the OAdate specifications, the maximum valid date is 9999-12-31 23:59:59 (plus 999 milliseconds).
See also:
https://docs.microsoft.com/en-us/dotnet/api/system.datetime.tooadate?view=netcore-3.1
See also:
https://docs.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year
See Also
Reference
Utils Class
NanoXLSX Namespace
Copyright Raphael Stoeckli © 2025