intvNo Function

Calculates the number of intervals between two dates when you divide the time into the specified intervals.


int intvNo(date input_date, date ref_date, int func)

Parameter

Description

input_date

A date that indicates the end of the period

ref_date

A date that indicates the start of the period.

func

An intvScale enumeration value.

The number of intervals between the dates specified by the ref_date and input_date parameters.

static void intvNoExample(Args _args)
{
    date inputDate = str2Date("1/1/2007", 213);
    date refDate = str2Date("3/1/2007", 213);
    int noOfIntervals;
    ;
    noOfIntervals = intvNo(refDate, inputDate, intvScale::Month);
    print noOfIntervals;
    pause;
    //noOfIntervals now holds the difference in months between March and January (2).
}

Community Additions

ADD
Show: