# Isolating the hour, minutes, seconds, or fractional seconds of a time

The HOUR function returns the hour part of a value. The argument must be a time, timestamp, or a decimal number that is interpreted as a time.

For example, if you want to query the data in the Q.INTERVIEW table to determine the time that a particular interview ended, you could run a query like the following:
SELECT TEMPID, ENDTIME
FROM Q.INTERVIEW
WHERE TEMPID = 400

QMF shows the ENDTIME column and the time displays the hours, minutes, and seconds, as shown in the following figure.

To show only the hour that the interview ended, you could run a query like the following:
SELECT TEMPID, HOUR(ENDTIME)
FROM Q.INTERVIEW
WHERE TEMPID = 400
QMF produces the report shown in the following figure, which shows only the hour portion of ENDTIME:

The MINUTE function returns the minute part of a value. The argument must be a time, timestamp, or a decimal number that is interpreted as a duration of hours, minutes, or seconds.

For example, consider the following SQL statement:
SELECT TEMPID, MINUTE(ENDTIME)
FROM Q.INTERVIEW
WHERE TEMPID = 400
When you run this query, QMF produces the report shown in the following figure:
The SECOND function returns the seconds part of a value. The argument must be a time, timestamp, or a decimal number that is interpreted as a duration of hours, minutes, or seconds. For example, consider the following SQL statement:
SELECT TEMPID, SECOND(ENDTIME)
FROM Q.INTERVIEW
WHERE TEMPID = 400
When you run this query, QMF produces the report shown in the following figure:
The MICROSECOND function returns the part of a value that represents fractional seconds. The argument can only be a column that contains timestamp data. For example, consider the following SQL statement, where the argument for the MICROSECOND function is a column named TIMESTAMP in the Q.PROJECT sample table:
SELECT PROJNO, MICROSECOND(TIMESTAMP)
FROM Q.PROJECT
WHERE PROJNO = '1409'
When you run this query, QMF produces the report shown in the following figure:

The portion of a timestamp that represents fractional seconds can be from zero to 12 characters. The TIMESTAMP column of the Q.PROJECT sample table has a timestamp precision of six characters.