1
votes

I have this string duration format in a column in SQL: "00:01:52"

So, I want to convert it to minutes int

00:01:52 means: 0 hours, 1 minutes, 52 seconds

In this case it will be 1 min.

How can I make a query to get the data at 'int' variable

1
I removed the conflicting tags: mysql <> sql-server <> postgresql - especially when it comes to date/time functions, which are highly vendor-specific. Please tag only the database that you are using.GMB
What have you tried? SQL Server provides a number of datetime functions.Dale K

1 Answers

0
votes

In SQL Server, you can use:

select datediff(minute, 0, convert(time, '00:01:52'))