Function _conPutDS() Foundation

Assigns a character string as a date value to a container or produces a new date container.

Syntax
ContainerHandle _conPutDS(ContainerHandle ch, CHAR pcBuffer[8]);
Parameters
ContainerHandle ch
Handle of any container or NULLCONTAINER.
CHAR pcBuffer[8]
Pointer to the date character string which is to be assigned to the container. Only the first 8 characters are used.
Return

Returns either the passed container handle or a handle to a new container. The return value is NULLCONTAINER if an error occurrs.

Description

_conPutDS() is used to assign a date value to a container. The date value in the passed buffer must be a character string in the format "YYYYMMDD". This format is independent of the actual system date format setting. The year is formatted with 4 digits, month and day each with two digits with leading zeros (example: 7/22/94 -> "19940722"). Any additional characters in the character string are ignored. If the passed character string is not a valid date, a NULL date is passed to the container.

When the passed container handle has the value NULLCONTAINER, a new date container is created. Otherwise, the date value is assigned to the passed container.

When a new container is created, it must be released with _conRelease() as soon as it is no longer needed.

Examples
/* 
   Produces a new date container. 
*/ 
#include <xppcon.h> 
#include <stdio.h> 

ContainerHandle  hDate; 
CHAR             buffer[9]; 
int              year = 1994, 
                 month = 7, 
                 day = 29; 
XPPAPIRET        xr; 


sprintf(buffer,"%04%02%02", year, month, day); 
hDate = _conPutDS(hDate, buffer); 

if (hDate != NULLCONTAINER) 
{ 
   /* ... operations with the date container */ 

   _conRelease(hDate); 
} 
else 
{ 
   xr = _conLastError(); 
   /* ... error handling */ 
} 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.