OCIDateSysDate
Purpose : You can call this function to get the current system date and time of the client.
Syntax :
sword OCIDateSysDate (
OCIError *err,
OCIDate *sys_date );
Parameters :
| Parameter | Description |
|---|---|
| err(IN/OUT) | The error handle. |
| sys_date(OUT) | The current system date and time of the client. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateToText
Purpose : You can call this function to convert a date type to a character string.
Syntax :
sword OCIDateToText (
OCIError *err,
const OCIDate *date,
const OraText *fmt,
ub1 fmt_length,
const OraText *lang_name,
ub4 lang_length,
ub4 *buf_size,
OraText *buf );
Parameters :
| Parameter | Description |
|---|---|
| err(IN/OUT) | The error handle. |
| date(IN) | The date to be converted. |
| fmt(IN) | The conversion format. If it is NULL or (text *) 0, the date is converted to a string in the default date format of DD-MON-YY. |
| fmt_length(IN) | The length of the fmt parameter. |
| lang_name(IN) | Specifies the language in which names and abbreviations for months and days are returned. The default language of the session is used if lang_name is NULL or ((text *) 0). |
| lang_length(IN) | The length of the lang_name parameter. |
| buf_size(IN/OUT) | The size of the buffer (IN). The size of the resulting string is returned by using this parameter (OUT). |
| buf(OUT) | The buffer where the converted string is placed. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateFromText
Purpose : You can call this function to convert a string to a date type in the specified format.
Syntax :
sword OCIDateFromText (
OCIError *err,
const OraText *date_str,
ub4 d_str_length,
const OraText *fmt,
ub1 fmt_length,
const OraText *lang_name,
ub4 lang_length,
OCIDate *date );
Parameters :
| Parameter | Description |
|---|---|
| err(IN/OUT) | The error handle. |
| date_str(IN) | The date to be converted. |
| d_str_length(IN) | The size of the input string. The date_str parameter is considered as a string that ends with NULL if the length is -1. |
| fmt(IN) | The conversion format. If fmt is a NULL pointer, the string must be in the DD-MON-YY format. |
| fmt_length(IN) | The length of the fmt parameter. |
| lang_name(IN) | Specifies the language in which names and abbreviations for months and days are returned. The default language of the session is used if lang_name is NULL. |
| lang_length(IN) | The length of the lang_name parameter. |
| date(OUT) | The date obtained by converting the given string. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeToText
Purpose : You can call this function to convert a given date to a string in the specified format.
Syntax :
sword OCIDateTimeToText (
void *hndl,
OCIError *err,
const OCIDateTime *date,
const OraText *fmt,
ub1 fmt_length,
ub1 fsprec,
const OraText *lang_name,
size_t lang_length,
ub4 *buf_size,
OraText *buf );
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. If the user session handle is passed, the conversion takes place in NLS_LANGUAGE and NLS_CALENDAR of the session. Otherwise, the default value is used. |
| err(IN/OUT) | The error handle. |
| date(IN) | The date to be converted. |
| fmt(IN) | The conversion format. If fmt is a NULL pointer, the result must be in the default format of the DATETIME type. |
| fmt_length(IN) | The length of the fmt parameter. |
| fsprec(IN) | Specifies the fractional second precision. |
| lang_name(IN) | Specifies the language in which names and abbreviations for months and days are returned. The default language of the session is used if lang_name is NULL. |
| lang_length(IN) | The length of the lang_name parameter. |
| buf_size(IN/OUT) | The size of the buffer (IN). The size of the converted string (the result of the conversion) is returned (OUT). |
| buf(OUT) | The buffer where the converted string is placed. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeFromText
Purpose : You can call this function to convert a given string to Oracle datetime in the specified format.
Syntax :
sword OCIDateTimeFromText (
void *hndl,
OCIError *err,
const OraText *date_str,
size_t dstr_length,
const OraText *fmt,
ub1 fmt_length,
const OraText *lang_name,
size_t lang_length,
OCIDateTime *datetime );
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. If the user session handle is passed, the conversion takes place in NLS_LANGUAGE and NLS_CALENDAR of the session. Otherwise, the default value is used. |
| err(IN/OUT) | The error handle. |
| date_str(IN) | The input string to be converted to Oracle datetime. |
| dstr_length(IN) | The size of the input string. The date_str parameter is considered as a string that ends with NULL if the length is -1. |
| fmt(IN) | The conversion format. If fmt is a NULL pointer, the result must be in the default format of the DATETIME type. |
| fmt_length(IN) | The length of the fmt parameter. |
| lang_name(IN) | Specifies the language in which names and abbreviations for months and days are returned. The default language of the session is used if lang_name is NULL. |
| lang_length(IN) | The length of the lang_name parameter. |
| datetime(OUT) | The datetime obtained by converting the given string. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeConstruct
Purpose : You can call this function to construct a datetime descriptor.
Syntax :
sword OCIDateTimeConstruct (
void *hndl,
OCIError *err,
OCIDateTime *datetime,
sb2 year,
ub1 month,
ub1 day,
ub1 hour,
ub1 min,
ub1 sec,
ub4 fsec,
OraText *timezone,
size_t timezone_length );
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. |
| err(IN/OUT) | The error handle. |
| datetime(IN) | The pointer to an OCIDateTime descriptor. |
| year(IN) | The value for year. |
| month(IN) | The value for month. |
| day(IN) | The value for day. |
| hour(IN) | The value for hour. |
| min(IN) | The value for minute. |
| sec(IN) | The value for second. |
| fsec(IN) | The value for fractional second. |
| timezone(IN) | The time zone string. The time zone offset of a particular time zone from GMT in the format of [[+|-][HH:MM]. For example: -08:00. |
| timezone_length(IN) | The length of the time zone string. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeGetTime
Purpose : You can call this function to fetch the time (including the values for hour, minute, second, and fractional second) out of a datetime value.
Syntax :
void OCIDateTimeGetTime (
void *hndl,
OCIError *err,
OCIDateTime *datetime,
ub1 *hour,
ub1 *min,
ub1 *sec,
ub4 *fsec );
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. |
| err(IN/OUT) | The error handle. |
| datetime(IN) | The pointer to an OCIDateTime descriptor. |
| hour(OUT) | The value for hour. |
| min(OUT) | The value for minute. |
| sec(OUT) | The value for second. |
| fsec(OUT) | The value for fractional second. |
Return value : NULL.
OCIDateTimeGetDate
Purpose : You can call this function to fetch the date (including values for the year, month, and day) out of a datetime value.
Syntax :
void OCIDateTimeGetDate (
void *hndl,
OCIError *err,
const OCIDateTime *datetime,
sb2 *year,
ub1 *month,
ub1 *day );
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. |
| err(IN/OUT) | The error handle. |
| datetime(IN) | The pointer to an OCIDateTime descriptor. |
| year(OUT) | The value for year. |
| month(OUT) | The value for month. |
| day(OUT) | The value for day. |
Return value : NULL.
OCIDateTimeGetTimeZoneOffset
Purpose : You can call this function to fetch the time zone (including values for the hour and minute) out of a datetime value.
Syntax :
void OCIDateTimeGetTimeZoneOffset (
void *hndl,
OCIError *err,
const OCIDateTime *datetime,
sb1 *hour,
sb1 *min);
Parameters :
| Parameter | Description |
|---|---|
| hndl(IN) | The OCI user session handle or environment handle. |
| err(IN/OUT) | The error handle. |
| datetime(IN) | The pointer to an OCIDateTime descriptor. |
| hour(OUT) | The retrieved hour value of the time zone. |
| min(OUT) | The retrieved minute value of the time zone. |
Return value : NULL.
OCIDateTimeAssign
Purpose : You can call this function to assign a datetime.
Syntax :
sword OCIDateTimeAssign ( void *hndl,
OCIError *err,
const OCIDateTime *from,
OCIDateTime *to );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. If the user session handle is passed, the conversion takes place in NLS_LANGUAGE and NLS_CALENDAR of the session. Otherwise, the default value is used. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| from (IN) | The source, namely the right side (rhs) of the datetime assignment. |
| to (OUT) | The destination, namely the left side (lhs) of the datetime assignment. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeCheck
Purpose : You can call this function to check whether a given date is valid.
Syntax :
sword OCIDateTimeCheck ( void *hndl,
OCIError *err,
const OCIDateTime *date,
ub4 *valid );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| date (IN) | The date to be checked. |
| valid (OUT) | Returns 0 if the date is valid. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeCompare
Purpose : You can call this function to compare two datetime values.
Syntax :
sword OCIDateTimeCompare ( void *hndl,
OCIError *err,
const OCIDateTime *date1,
const OCIDateTime *date2,
sword *result );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| date1, date2 (IN) | The dates to be compared. |
| result (OUT) | The comparison result. For more information, see the table in the Additional information section. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
Additional information
| Comparison result | Output |
|---|---|
date1<date2 |
-1 |
date1=date2 |
0 |
date1>date2 |
1 |
OCIDateTimeConvert
Purpose : You can call this function to convert a datetime variable to another type.
Syntax :
sword OCIDateTimeConvert ( void *hndl,
OCIError *err,
OCIDateTime *indate,
OCIDateTime *outdate );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| indate (IN) | The pointer to the input date. |
| outdate (OUT) | The pointer to the output datetime. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeGetTimeZoneName
Purpose : You can call this function to obtain the name of the time zone from a datetime value.
Syntax :
sword OCIDateTimeGetTimeZoneName ( void *hndl,
OCIError *err,
const OCIDateTime *datetime,
ub1 *buf,
ub4 *buflen, );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| datetime (IN) | The pointer to an OCIDateTime descriptor. |
| buf (OUT) | The buffer that stores the retrieved time zone name. |
| buflen (IN/OUT) | The size of the buffer (IN), and the size of the name field (OUT). |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.
OCIDateTimeSysTimeStamp
Purpose : You can call this function to obtain the current system date and time as a timestamp with a time zone.
Syntax :
sword OCIDateTimeSysTimeStamp ( void *hndl,
OCIError *err,
OCIDateTime *sys_date );
Parameters :
| Parameter | Description |
|---|---|
| hndl (IN) | The OCI user session handle or environment handle. |
| err (IN/OUT) | The error handle. If any error occurs, it is recorded in err, and the function returns OCI_ERROR. You can call OCIErrorGet to obtain the diagnostic information. |
| addend1 (IN) | The pointer to the output timestamp. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.