Version

ExcelDateToTimeOfDay Method

Converts Excel's numerical representation of a time of day to a TimeSpan.
Syntax
'Declaration
 
Public Shared Function ExcelDateToTimeOfDay( _
   ByVal excelDate As Double, _
   Optional ByVal useDayInfo As Boolean _
) As TimeSpan
public static TimeSpan ExcelDateToTimeOfDay( 
   double excelDate,
   bool useDayInfo
)

Parameters

excelDate
The Microsoft Excel date format which should be converted to a DateTime.
useDayInfo
Optional parameter to allow the day information to be included as well.
Remarks

In Excel, only the fractional portion of the date value represents the time of day, so if excelDate is greater than 1, only the fractional part will be used.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also