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



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

Parameters

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

Return Value

A TdTimestampWithTimeZone is returned that is equivalent to the timestamp contained in the value string.
Exceptions
ExceptionDescription
Value is a null reference or an empty string.
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 time component 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+08:00" the sub-seconds is separated from the number of seconds using a decimal point.

When the value is parsed the TdTimestampWithTimeZone.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 timestamp 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 a UTC offset is specified in the string it must appear at the end.

If the value contains a "Z" or "GMT", the UTC offset has been accounted for in the time component. Therefore, the UTC offset of the TdTimestampWithTimeZone that is returned will be set to "00:00".

If the value does not contain a UTC offset, "Z", or "GMT" the UTC offset of the TdTimestampWithTimeZone that is returned will be set to the local UTC offset.

If the value contains the string "NULL" a TdTimestampWithTimeZone.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

TdTimestampWithTimeZone Structure
TdTimestampWithTimeZone Members
Overload List