Date and time routines
A date routine is a user-written exit routine to change date values from a locally defined format to a format that is recognized by Db2 and from the ISO format to the locally defined format. Similarly, a time routine changes time values from a locally defined format to one that is recognized by Db2 and from the ISO format to the locally-defined format.
The following is a list of the formats recognized
by Db2.
Format name | Abbreviation | Typical date | Typical time |
---|---|---|---|
IBM® European standard | EUR | 25.12.2004 | 13.30.05 |
International Standards Organization | ISO | 2004-12-25 | 13.30.05 |
Japanese Industrial Standard Christian Era | JIS | 2004-12-25 | 13:30:05 |
IBM USA standard | USA | 12/25/2004 | 1:30 PM |
Example: Suppose that you want to insert and retrieve dates
in a format like September 21, 2006
. You can use a date routine
that transforms the date to a format that is recognized by Db2 on insertion, such as ISO: 2006-09-21
.
On retrieval, the routine can transform 2006-09-21
to September
21, 2006
.
You can have either a date routine, a time routine, or both. These
routines do not apply to timestamps. Special rules apply if you execute
queries at a remote DBMS, through the distributed data facility.