Reference > TDBDTCalcX Object > TDBDTCalcX Object Properties > BaseZero Property (TDBDTCalcX) |
BaseZero Property (TDBDTCalcX)
Sets/returns whether calculation is zero-based.
object.BaseZero= boolean
Read/Write at run time. Not available at design time.
The BaseZero property is used to determine whether the calculation result will return either zero-based or one-based, which provides flexibility and also resolves the following problem:
Dim obj as New TDBDTCalcX
With obj
.DaysPerMonth = 30
.InitValue "1998/10/1"
.CalcValue 29, dbiCalcDays
Debug.Print .Years, .Months, .Days
End With
The result for the example above will return 1998 for years, 11 for months, 0 for days which is correct, but a problem arises when trying to convert the underlying amount of days to a date type using the ValueToDate method. So the BaseZero property was added to avoid this problem.
If the BaseZero property is set to False, since the calculation result is one-based, the results for the above example will return 1998 for years, 10 for months, 30 for days - which later can be converted to a correct date.
If set to True - Calculation is zero-based.
If set to False - Calculation is one-based. (Default)
This property is effective only on the date portion (Years, Months, Days) and not the time (Hours, Minutes, Seconds).
See Also