I have a column in a table that stores the number of minutes as a numeric(18,4)
field named [course_access_minutes]
.
The stored values come from a blackboard database and look like this:
0.0500
0.0667
0.3667
up to
314.0833
625.8167
How do I convert these to time hh:mm, I've had a good look at the database documentation and all I can find is
course_access_minutes numeric(18,4) This is the number of minutes that the user accesses this course in total during this login session.
Can I assume that I can make a direct conversion from minutes into hours? I think I will take any values below 1 as 0 minutes. What is the best way to do this in SQL? Thanks in advance for your help.
There are 60 minutes in 1 hour. To convert from minutes to hours, divide the number of minutes by 60. For example, 120 minutes equals 2 hours because 120/60=2.
Convert 78.6 minutes to hh:mm:ss 78.6 minutes can be converted to hours by dividing 78.6 minutes / 60 minutes/hour = 1.31 hours 1.31 hours can be broken down to 1 hour plus 0.31 hours - 1 hour 0.31 hours * 60 minutes/hour = 18.6 minutes - 18 minutes
To convert minutes to hours and minutes by division and multiplication, divide the minutes by 60. if the result is a number with a decimal part, then. the hours is the integer part.
How to convert decimal minutes to time format. Convert 78.6 minutes to hh:mm:ss. 78.6 minutes can be converted to hours by dividing 78.6 minutes / 60 minutes/hour = 1.31 hours; 1.31 hours can be broken down to 1 hour plus 0.31 hours - 1 hour; 0.31 hours * 60 minutes/hour = 18.6 minutes - 18 minutes
There are 60 minutes in an hour or 60 minutes per hour. Written mathematically as a value of 1 it is [60 min / 1 hr] = 1. The inverse is also true that [1 hr / 60min] = 1 To convert minutes to hours, divide the minutes by 60.
Try this
SELECT CONVERT(varchar, DATEADD(s, 625.8167 * 60, 0), 108)
If the duration is longer than 24 hours you can use this
SELECT CONVERT(varchar, CAST(1877.4501 * 60 AS int) / 3600)
+ RIGHT(CONVERT(varchar, DATEADD(s, 1877.4501 * 60, 0), 108), 6)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With