'Usage Dim years As Integer Dim months As Integer Dim instance As New TdIntervalYearToMonth(years, months)
Parameters
- years
- Number of years.
- months
- Number of months.
'Usage Dim years As Integer Dim months As Integer Dim instance As New TdIntervalYearToMonth(years, months)
Exception | Description |
---|---|
OverflowException | The parameters specify a TdIntervalYearToMonth value less than TdIntervalYearToMonth.MinValue or greater than TdIntervalYearToMonth.MaxValue. |
The number of years and months are converted into months first and then evaluated against TdIntervalYearToMonth.MinValue and TdIntervalYearToMonth.MaxValue. The TdIntervalYearToMonth.Precision is then calculated from the number of digits contained within the interval year component.
For example, a year value of 99 and a month value of 45 results in a value in total months of 1233 months. The TdIntervalYearToMonth literal representation results in a TdIntervalYearToMonth value of 102 years and 9 months within the range of less than or equal to MaxValue and greater than or equal to the MinValue. Precision is calculated to be a value of 3 representing 3 significant digits in the year.
A year value of 200 and a month value of 118,000 results in a value in total months of 120,400 months. The TdIntervalYearToMonth literal representation results in a TdIntervalYearToMonth value of 10,033 years and 4 months exceeding the maximum value of '9999-11'.
Negative constructor parameters may be supplied to represent negative durations of time. Mixed positive and negative constructor parameters are added together that result in a negative or positive TdIntervalYearToMonth. For instance, a year value of 200 and a month value of -4900 will result in a TdIntervalYearToMonth interval value of -'208-04' with a calculated precision value of 3.
Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019