ITimeSeries.AlignedDate

Syntax

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

Parameters

Value. Checked date.

Forward. Calendar offset direction. Optional parameter.

ThrowException. Indicates whether to generate the exception if the checked date is out of limits of series dates. Optional parameter. Available values:

Description

The AlignedDate property returns nearest valid date.

Comments

If the checked date is a day off, 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 shows the user calculation method for a series with daily frequency. To execute the example, add links to the Ms, Transform system assemblies.

Function UserAlignedDate(Input: ITimeSeries): ITimeSeries;
Var
    pContext: ITsCalculationContext;
    i: Integer;
    pSeries: ITimeSeries;
Begin
    pContext := TsCalculation.Current;
    pSeries := pContext.CreateTimeSeries;
    For i := Input.StartIndex To Input.EndIndex Do
        If Input.AlignedDate(Input.IndexToDate(i)) = Input.IndexToDate(i) Then
            pSeries.Item(i) := 1 + Input.Item(i);
        End If;
    End For;
    Return pSeries;
End Function UserAlignedDate;

The method increases series values that correspond to working days.

See also:

ITimeSeries