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



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

Parameters

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

Return Value

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

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

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

When the value is parsed the TdTimestamp.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 TdTimestamp of "2008-11-21 12:32:11.0000" will have a Scale of 4, and "2009-04-15 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 TdTimestamp.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

TdTimestamp Structure
TdTimestamp Members
Overload List