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 System.Double, _
   Optional ByVal useDayInfo As System.Boolean _
) As System.TimeSpan
public static System.TimeSpan ExcelDateToTimeOfDay( 
   System.double excelDate,
   System.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 8.1, Windows 8.1, Windows 8, Windows 7, 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

View on GitHub