Returns the value of the NBElement passed in after first converting it to a TimeSpan if required using specified format and conversion.

C# | Visual Basic | Visual C++ | F# |
public static TimeSpan ToTimeSpan( NBElement value, string format, NBElementTimeSpanType convertVia )
Public Shared Function ToTimeSpan ( _ value As NBElement, _ format As String, _ convertVia As NBElementTimeSpanType _ ) As TimeSpan
public: static TimeSpan ToTimeSpan( NBElement^ value, String^ format, NBElementTimeSpanType convertVia )
static member ToTimeSpan : value:NBElement * format:string * convertVia:NBElementTimeSpanType -> TimeSpan

- value (NBElement)
- The element whose value is to be converted.
- format (String)
- The element whose value is to be converted.
- convertVia (NBElementTimeSpanType)
- The type conversion qualifier for element.

The current element's value converted to a TimeSpan data type using the specified format and with the specified conversion of the element.

As there are multiple choices when converting from a broker type to a TimeSpan, this method allows you greater control over how the convertion is performed. The value is first converted to the convertVia type, and then subsequently converted to a TimeSpan.
The format string uses the syntax documented in the Infocenter in the topic "Formatting and parsing dateTimes as strings (ak05616)".

Exception | Condition |
---|---|
FormatException | Thrown if the value can not be converted to a TimeSpan with the given format and conversion. |