Home > OS >  Convert numeric column to time
Convert numeric column to time

Time:01-18

I have a table of employee shifts which include shift start time and shift end time. The start time and end time columns are numeric with a full stop between hour and minute:

 8.00
15.10
 7.00
22.00
 7.00

How can I convert these columns to time? I also need to calculate the difference between start time and end time in hours and minutes to work out the shift length.

CodePudding user response:

In Sql Server use following code

declare @seconds numeric
set @seconds = 12366
select convert(char(8), dateadd(second, @seconds, ''), 114)

CodePudding user response:

In Sql Server use following code

SELECT CONVERT(DATETIME, CONVERT(CHAR(9), CURRENT_TIMESTAMP, 112)   '22:00');
  •  Tags:  
  • Related