Skip to content

MAKE_TIME

Make a complete TIME value from a series of input values that represent hours, minutes, and seconds.

MAKE_TIME(hour, minute, seconds)
  • The hour and minute values are integers.
  • The seconds value is a double precision number.

For example:

premdb=# select make_time(8, 15, 23.5) from sys.const;
 make_time  
------------
 08:15:23.5
(1 row)

The seconds value supports up to 6 fractional digits of precision. Additional digits are rounded up. For example:

premdb=# select make_time(8, 15, 23.5555555) from sys.const;
   make_time    
-----------------
 08:15:23.555556
(1 row)

The following example extracts the hour value from a TIMESTAMP column, adds 15 to it, and uses it as the first part of the MAKE_TIME result:

premdb=# select make_time(extract(hour from matchday)::int +15, 00, 00) 
from match where seasonid=12 limit 1;
 make_time 
-----------
 15:00:00
(1 row)