Skip to content
Advertisement

Convert HH:MM:S to seconds int

I have two columns with the format YYYY-MM-DD HH:MM:SS When I do the difference between these two columns, my result has a format of the form HH:MM:SS

I would like to convert this result into seconds. How can I make it?

Example:

2019-06-15 19:27:33.045000 | 2019-06-15 19:27:22.298000 | 00:00:10.747

Advertisement

Answer

You can use DATEDIFF ( datepart, {date|timestamp}, {date|timestamp} ) function for more info check here

for e.g

 select datediff(second, '0','05:15:40');
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement