IMsTimeMatrix.AlignedDate

Fore Syntax

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

Fore.NET Syntax

AlignedDate[Value: System.DateTime;
           Forward: boolean;
           ThrowException: boolean]: System.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. Available values:

Description

The AlignedDate property returns nearest valid date.

Comments

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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;

Public Function UserAlignedDate(param: IMsTimeMatrix): object;
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, TrueTrue] = IndDate Then
            System.Diagnostics.Debug.WriteLine(m.Item[i]);
        End If;
    End For;
    Return m;
End Function UserAlignedDate;

See also:

IMsTimeMatrix