Data Access Builder supports mapping columns of SQL types DATE, TIME, and TIMESTAMP to attributes with C++ types IDate, ITime, and ITimestamp. See the related links to the data type conversion tables, below, for specific information on default and supported mappings of DATE, TIME, and TIMESTAMP.
If a <class> object has attributes of these types, it is important to know what format to use when setting these attributes, and what format to expect when retrieving their values. Data Access Builder uses the ODBC standard format for both getting and setting IDate, ITime, and ITimestamp attributes. The following table shows the format for passing in and retrieving these types:
| SQL Type | Default C++ Type Mapping | Get and Set Format |
|---|---|---|
| DATE | IDate | YYYY-MM-DD |
| TIME | ITime | hh:mm:ss |
| TIMESTAMP | ITimestamp | YYYY-MM-DD hh:mm:ss.nnnnnnnnn |
Note: YYYY = Year; MM = Month; DD = Day; hh = Hours (24-hour clock); mm = Minutes; ss = seconds; nnnnnnnnn = parts of a second.
For example, to set a TimeOfSale attribute for a Car object, you would call the following code:
Car.setTimeOfSale('14:26:00');
![]()
ODBC Data Type Conversion Table
DB2 ESQL Data Type Conversion Table
