DATE CTOD()

From Lianjapedia
Jump to: navigation, search

PURPOSE

Return the date as a character string

SYNONYM

api_date_ctod()

SYNOPSIS

#include "lianja_api.h"
 
unsigned long	DATE_CTOD(string)
 
<input parameters>
char	string;		/*address of a buffer containing a valid date string	*/
 
<output parameters>
none

DESCRIPTION

The DATE_CTOD() function will return the specified date as an unsigned long which is the date storage format.

The character expression must be in the form month/day/year if you have issued the SET DATE AMERICAN command, or day/month/year if you have entered the SET DATE BRITISH command, or must be correctly formatted if any other data type has been specified with the SET DATE command. The format must also match the current SET CENTURY setting, four digit years if SET CENTURY is ON, two digit years if SET CENTURY is OFF.

If an invalid date string is specified then a value of zero will be returned.

EXAMPLE

The following example converts the date "02/02/99" to an unsigned long, then updates the memory variable specified in the first parameter as a date type.

#include "lianja_api.h"
 
lianjaapi_date_ctod()
{
    unsigned long		date;
    struct API_MEMVAR	*tmpbuf;
 
    date = DATE_CTOD( "02/02/99" );
 
    if (_parinfo(1) == API_CTYPE) {
       MEMVAR_UPDATE(_parc(1), 'D', 2, 0,
       tmpbuf->value.info_character,
       tmpbuf->value.info_number,
       tmpbuf->value.info_logical,
       date );
    }
}

SEE ALSO

_parinfa(), _parinfo(), _pards(), _retds(), ISDATE(), DATE_AMPM(), DATE_CDOW(), DATE_CMONTH(), DATE_DATE(), DATE_DAY(), DATE_DOW(), DATE_DTOC(), DATE_DTOS(), DATE_MONTH(), DATE_STOD(), DATE_TIME(), DATE_YEAR()