IMsTimeMatrix.DateToIndex

Syntax

DateToIndex(Value: DateTime): Integer;

Parameters

Value. Calendar series point.

Description

The DateToIndex method transforms date to index.

Comments

To transform index to date, use the IMsTimeMatrix.IndexToDate method.

Example

This example describes custom method.

To execute the example, add links to the MS, MathFin system assemblies.

Public Function Max(Matrix: IMsTimeMatrix): Variant;
Var
    Serie : ITimeSeries;
    index, i : integer;
    arr : Array Of double;
Begin
    Serie := New TimeSeries.Create;
    index := Matrix.CurrentIndex;
    If Matrix.DateToIndex(Matrix.ForecastStartDate) <> index Then
        For i := 0 To Matrix.PointCount - 1 Do
            arr := Matrix.Column(i) As Array Of double;
            Serie.Item(i) := Math.Max(arr);
        End For;
    End If
    Return Serie;
End Function Max;

The method finds maximum value in matrix series points if the value obtained on transformation of date into index does not match the current calculation index.

See also:

IMsTimeMatrix