Skip to content
Advertisement

How to Convert Hours, minutes and seconds (HH:mm:ss) to minutes and seconds (mm:ss) in SQL

Suppose I have 2hrs, 47minutes and 10 second (02:47:10) which is in hh:mm:ss format as a value in Time column. I would like to convert it to minutes and seconds only (mm:ss). Hence the result should be 167minutes and 10 secs in sql. I have tried using the code

The result was 167.166666.

My desired output should be 167:10 (mm:ss) format

Advertisement

Answer

Perhaps a lighter approach with less string manipulation

Example

Results

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement