isc_encode_timestamp()
Go Up to API Function Reference
Translates a time from the C struct tm
format to InterBase ISC_TIMESTAMP
format prior to inserting or updating a TIMESTAMP
value in a table.
Syntax
void isc_encode_timestamp(
void *tm_date,
ISC_TIMESTAMP *ib_timestamp);
Parameter | Type | Description |
---|---|---|
|
|
Pointer to a C |
|
|
Pointer to an eight-byte |
Description
isc_encode_timestamp()
translates a date in a C time structure into an ISC_TIMESTAMP
format internal to InterBase. This call is used prior to writing TIMESTAMP
data to a table to guarantee that the date and time are in a format recognized by InterBase. This call is exactly the same as the older isc_encode_date()
, which is still available for backward compatibility.
Use the isc_dsql
family of API calls to insert or update TIMESTAMP
data from the ISC_TIMESTAMP
structure in a table.
- Note: isc_encode_timestamp() does not support milliseconds, because encode/decode functions use the structure struct tm from
time.h
, which does not support a fractional part for seconds.
Example
The following code fragment illustrates declaring time structures and calling isc_encode_timestamp()
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_TIMESTAMP hire_date; . . . /* Store date and time info into the tm struct here. */ . . . isc_encode_timestamp (&hire_time, &hire_date); /* Now use DSQL INSERT or UPDATE to move the date into a TIMESTAMP column. */
Return value
None.