IMsTimeMatrix.AlignedDate

Syntax

AlignedDate(Value: DateTime;
           [Forward: Boolean = true;]
           [ThrowException: Boolean = true]): DateTime;

Parameters

Value. Checked date.

Forward. Calendar offset direction.

ThrowException. Indicates whether to throw exception if the verifiable date is out of limits of series dates.

Description

The AlignedDate property returns nearest valid date.

Comments

Available values of the ThrowException parameter:

If the verifiable date is a holiday, the method returns the nearest valid date depending on value of the Forward parameter:

If the checked date is a working day, the method returns the checked date without changes.

Example

This example describes custom method.

To execute the example, add links to the Ms system assemblies.

Public Function UserAlignedDate(param: IMsTimeMatrix): Variant;
Var 
    m : IMsTimeMatrix;
    i : Integer;
    IndDate: DateTime;
Begin
    m := New MsTimeMatrix.Create;
    For i := m.StartIndex To m.EndIndex Do
        IndDate := m.IndexToDate(i);
        If m.AlignedDate(IndDate) = IndDate Then
            Debug.WriteLine(m.Item(i));
        End If;
    End For;
    Return m;
End Function UserAlignedDate;

After executing the example the console window displays values of matrix series points if the nearest valid date matches the date obtained after transforming index to date.

See also:

IMsTimeMatrix