From InterBase

Go Up to API Function Reference

Translates a date from the C struct tm format to InterBase ISC_DATE format prior to inserting or updating a DATE value in a table.


 void isc_encode_sql_date(
 void *tm_date,
 ISC_DATE *ib_date);
Parameter Type Description


void *

Pointer to a C struct tm structure



Pointer to a four-byte ISC_DATE structure containing a date in InterBase format.


isc_encode_sql_date() translates a date in a C time structure into an ISC_DATE format internal to InterBase. This call is used prior to writing DATE data to a table to guarantee that the date is in a format recognized by InterBase.

Use the isc_dsql family of API calls to insert or update DATE data from the ISC_DATE structure in a table.

Note: In InterBase 6 and later, the DATE data type is available only in dialect 3. It holds only date information, and does not include time information. In dialect 1, the TIMESTAMP data type holds both date and time information and is exactly equivalent to the DATE data type that was present in earlier versions of InterBase.


The following code fragment illustrates declaring time structures and calling isc_encode_sql_date() to translate a C time format into an InterBase date format prior to inserting or updating a table:

#include <time.h>
#include <ibase.h>
. . .
struct tm hire_time;
ISC_DATE hire_date;
. . .
/* Store date info into the tm struct here. */
. . .
isc_encode_sql_date(&hire_time, &hire_date);
/* Now use DSQL INSERT or UPDATE to move the date into a DATE column. */

Return value


See Also

Advance To: