View Raw SPL
/*****************************************************************************
*                                                                            *
*   ISDT.SPL     Copyright (C) 2012 DSP Development Corporation              *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:      Randy Race                                                  *
*                                                                            *
*   Synopsis:    Returns 1 if input is a series with date/time X units       *
*                                                                            *
*   Revisions:   10 Apr 2012  RRR  Creation                                  *
*                                                                            *
*****************************************************************************/


#if @HELP_ISDT

    ISDT

    Purpose: Returns 1 if the input is a series with a date or time X units.

    Syntax:  ISDT(val)

              val - A series, scalar or string input.

    Returns: 1 if the input is a series with date/time X units, else 0.

    Example:
             s1 = grand(100, 1);sethunits(s1, "daily");
             s2 = grand(100, 1);sethunits(s2, "time");
             s3 = grand(100, 1);sethunits(w3, "seconds");

             isdt(s1) == 1
             isdt(s2) == 1
             isdt(s3) == 0

             Both "daily" and "time" are considered date/time units, but
             "seconds" is not considered a date/time unit.

    Example:
             isdt(3)

             returns 0

    Remarks:
             A series with date/time X units displays tic values
             in terms of actual calendar or clock time. The starting date
             and time is determined by the series start date and start time.

             See SETDATE and SETTIME to set the series date and time.

             If the input is not a series, ISDT returns 0.

    See Also:
             isrt
             setdate
             sethunits
             settime
             units
#endif


/* is series a date/time series (has date/time X units) */
isdt(s)
{
        local status = 0;

        if (argc < 1) s = refwin(w0);

        if (isarray(s) && length(s) > 0)
        {
                status = isdtunit(gethunits(s));
        }

        return(status);
}