Parts()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

Return a pointer to a date time string


SYNONYM

api_par_ts()


SYNOPSIS

#include "dbapi.h"
 
char	*_parts(order [,index])
 
<input parameters>
int	order;		/* Placement in actual parameter list 	*/
int	index;		/* Array element index				*/
 
<output parameters>
none


DESCRIPTION

The _parts() function gets a datetime parameter from Recital and returns a character pointer in the format "YYYYMMDDHHMMSS". The order specifies the actual placement in the parameter list. If the parameter passed is a Recital array, then the optional index value is used to specify the required element number.

NOTE: there is only one pointer on the stack for _parts(). The 'C' strcpy() function must be used to copy the result to a variable, you cannot simple pass the pointer.


EXAMPLE

The following example copies the first parameter passed to a string and then returns the result.

Example Recital program:

m_datetime=datetime()
m_ansidatetime =datetime_ansi( m_datetime )
return

Example 'C' function:

#include "dbapi.h"
 
dbapi_datetime_ansi()
{
    char	datetime[15];
 
    if (_parinfo(1) == API_TTYPE ) {
       strcpy( datetime, _parts(1));
    } else {
       strcpy( date, "" );
    }
 
    _retc( datetime );
}


SEE ALSO

_retts(), ISDATETIME(), DATE_TTOS(), DATE_STOT()