DateTimeStringFormat IBM data server driver configuration keyword

Specifies the format to use when you insert date or time data into character columns.

Equivalent CLI keyword
DateTimeStringFormat
Equivalent IBM® Data Server Provider for .NET connection string keyword
None
db2dsdriver.cfg configuration syntax
<parameter name="DateTimeStringFormat" value="JIS | ISO | EUR | USA"/>
Default setting:
The JIS format is used when date or time data is inserted into character columns.
Usage notes:
The DateTimeStringFormat keyword affects the insertion of SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, or SQL_C_TYPE_TIMESTAMP, or SQL_C_TIMESTAMP_EXT data into the following column types:
  • SQL_CHAR
  • SQL_VARCHAR
  • SQL_LONGVARCHAR
  • SQL_CLOB

The DateTimeStringFormat keyword also affects the format of date or time columns that are retrieved into character strings. For example, retrieving data from an SQL_TYPE_TIMESTAMP column into an SQL_C_CHAR string is affected by the DateTimeStringFormat keyword setting.

The DateTimeStringFormat keyword value is ignored if you set all of the following attributes with the SQLSetEnvAttr() function or the SQLSetConnectAttr() function:
  • SQL_ATTR_DATE_FMT
  • SQL_ATTR_TIME_FMT

If you set only the SQL_ATTR_DATE_FMT attribute but not the SQL_ATTR_TIME_FMT attribute, the DateTimeStringFormat keyword value takes effect for the time data type.

If you set only the SQL_ATTR_TIME_FMT attribute but not the SQL_ATTR_DATE_FMT attribute, the DateTimeStringFormat keyword value takes effect for the date data type.

Table 1. Setting values
Format Date Time Timestamp
JIS yyyy-mm-dd hh:mm:ss yyyy-mm-dd hh:mm:ss.ffffff
ISO yyyy-mm-dd hh.mm.ss yyyy-mm-dd-hh.mm.ss.ffffff
EUR dd.mm.yyyy hh.mm.ss yyyy-mm-dd hh:mm:ss.ffffff*
USA mm/dd/yyyy hh:mm AM or PM yyyy-mm-dd hh:mm:ss.ffffff*
*Timestamps takes the default format if EUR or USA is specified. The default format is JIS.