Convert integer to TIME

Database
Enthusiast

Re: Convert integer to TIME

Hi,

I think this will work:

SELECT CAST(TRIM(CAST(1256 AS CHAR(4))||'00') AS TIME(0) FORMAT 'HHMISS');

Output:

-----------

12:56:00

HTH

Cheers,

Eco

Not applicable

Re: Convert integer to TIME

Hi there,

i have same problem with minor difference, i have a integer value with integer data type col. i need to convert the integer to time HH:MM:SS.SSSSSS, i need to insert the value as a time. what is is the best cast for converting and which data type coloumn to insert? i appreciate for all comments

Ambassador

Re: Convert integer to TIME

How is the time stored within the INT? 

hhmissssssss?