SQLTeam.com | Weblogs | Forums

Conversion of hours to minutes using Stored Procedures

tsql

#1

I am trying to convert hours to minutes using Stored Procedures in MySQL. For example,I am getting the output as 3 hour 15 minutes . I need to convert it as 195 minutes. I tried using multiple cases but nothing worked out for me.. Can you please help me if you have any code to solve this??? Actually the scenario is ,I will get output as xx hour xx minutes in a database field. I need to convert it into minutes and store it in another field.


#2

Sorry, but this is a SQL Server forum so you may not find folks here who are familiar with MySQL. In SQL Server I would use a function which I am 90% sure does not exist in MySQL so my answer wouldn't be any use ...

Basically I would get the HOURS component of the time, and multiple by 60, and then add the MINUTES component of the time.