Send feedback on this topic.
Teradata.Client.Provider
Subtract(TimeSpan) Method



Teradata.Client.Provider Namespace > TdPeriodTime Structure > Subtract Method : Subtract(TimeSpan) Method
The TimeSpan that will be subtracted.
The specified TimeSpan will be subtracted from this instance of TdPeriodTime.
Syntax
'Declaration
 
Public Overloads Function Subtract( _
   ByVal timeSpan As TimeSpan _
) As TdPeriodTime
'Usage
 
Dim instance As TdPeriodTime
Dim timeSpan As TimeSpan
Dim value As TdPeriodTime
 
value = instance.Subtract(timeSpan)
public TdPeriodTime Subtract( 
   TimeSpan timeSpan
)
public:
TdPeriodTime Subtract( 
   TimeSpan timeSpan
) 

Parameters

timeSpan
The TimeSpan that will be subtracted.

Return Value

A TdPeriodTime is returned that is the result of the TimeSpan subtracted from this instance of TdPeriodTime.
Exceptions
ExceptionDescription
An invalid period will result in this operation.
Remarks

If this instance of TdPeriodTime is Null a TdPeriodTime.Null will be returned.

The only component of the TimeSpan object that will be considered is the time component. When this operation is performed, the time component of the TimeSpan is subtracted from this instance of TdPeriodTime. For example, if the period is "05:00:00, 06:30:00" and TimeSpan is "1.02:00:00.00" (1 day, 2 hours) the subtract operation will result in a period of (03:00:00, 04:30:00).

When subtracting a TimeSpan from a TdPeriodTime it is possible that the ending bound will roll into the next 24 hours, or the beginning bound will roll into the previous 24 hours. For example, suppose the period is

   (19:32:32.3404, 22:00:00.3232)

Subtracting the TimeSpan of "20:00:00" (20 hours) from the period will cause the beginning bound to roll back into the previous 24 hours which results in the invalid period:

    (23:32:32.3404, 02:00:00.3232)

Subtracting the TimeSpan of "-3:00:00" (-3 hours) from the period will cause the ending bound to roll into the next 24 hours which will result in the invalid period:

    (22:32:32.3404, 01:00:00.3232)

Refer to Period Arithmetic for additional information.

Requirements

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

See Also

Reference

TdPeriodTime Structure
TdPeriodTime Members
Overload List