In the following query, the EXTEND function
displays only the specified subfields to restrict the two DATETIME
values. Figure 1: Query
SELECT customer_num,
EXTEND (call_dtime, month to minute) call_time,
EXTEND (res_dtime, month to minute) res_time
FROM cust_calls
ORDER BY res_time;
The query returns the month-to-minute range for the columns
labeled call_time and res_time and gives an indication
of the work load. Figure 2: Query result
The TO_CHAR function can also format
DATETIME values. See The TO_CHAR function for
information about this built-in function, which can also accept DATE
values or numeric values as an argument, and returns a formatted character
string.
Besides the built-in time functions that these examples
illustrate, HCL Informix® also
supports the ADD_MONTHS, LAST_DAY, MDY, MONTHS_BETWEEN, NEXT_DAY,
and QUARTER functions. In addition to these functions,
the TRUNC and ROUND functions
can return values that change the precision of DATE or DATETIME arguments.
These additional time functions are described in the Informix Guide to SQL:
Syntax.