Send feedback on this topic.
Teradata.Client.Provider
Parse(String,IFormatProvider) Method



Teradata.Client.Provider Namespace > TdTime Structure > Parse Method : Parse(String,IFormatProvider) Method
The string that is to be converted into a TdTime.
An IFormatProvider that supplies culture specific information about the format of value.
The specified string is converted into an equivalent TdTime.
Syntax
'Declaration
 
Public Overloads Shared Function Parse( _
   ByVal value As String, _
   ByVal provider As IFormatProvider _
) As TdTime
'Usage
 
Dim value As String
Dim provider As IFormatProvider
Dim value As TdTime
 
value = TdTime.Parse(value, provider)
public static TdTime Parse( 
   string value,
   IFormatProvider provider
)
public:
static TdTime Parse( 
   String^ value,
   IFormatProvider^ provider
) 

Parameters

value
The string that is to be converted into a TdTime.
provider
An IFormatProvider that supplies culture specific information about the format of value.

Return Value

A TdTime is returned that is equivalent to the time contained in the value string.
Exceptions
ExceptionDescription
Value is a null reference.
Value does not contain a valid representation of a time.
Remarks

The string is parsed using the culture information contained in the specified Globalization.DateTimeFormatInfo object.

If the time contains sub-seconds, the separator that must be used in the string is a decimal point ("."). For example, in the string "10:21:22.2321" the sub-seconds is separated from the number of seconds using a decimal point.

When the value is parsed the TdTime.Scale will be set to the number of digits in the sub-seconds component (digits that are to the right of the decimal point). Therefore, a TdTime of "12:32:11.0000" will have a Scale of 4, and "23:43:22.121000" will have a scale of 6.

An attempt is made to avoid throwing a FormatException. Any unrecognized characters in the string will be ignored. An exception to this is the case when the number of digits to the right of the decimal point exceed the maximum scale of 6. If the number of digits exceed the maximum scale, a FormatException will get thrown. Trailing zeroes are ignored.

However, when a custom culture is used it is possible that the Parse will fail. A timestamp string that contains custom culture specific date elements is very difficult to parse. The string may not match any of the implicit patterns that are used to parse a string.

If the value contains the string "NULL" a TdTime.Null will be returned.

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdTime Structure
TdTime Members
Overload List