# Thread: Convert mins to day:hours:min

Join Date
Feb 2004
Location
New Zealand
Posts
1,482

## Unanswered: Convert mins to day:hours:min

I have a web that user are storing mins they are doing a job for

I have this code that display hh:mm
Code:
```Function MintoHrs(num)
If num<60 then
MintoHrs="00:" & DIG(num)
else
hh =int(num/60)
temp = (hh*60)
MintoHrs = DIG(hh) & ":" & DIG((num-temp))
end if
End Function```
but now they want to see broken down to days if > 24 hours

2. Purveyor of Discontent
Join Date
Mar 2003
Location
The Bottom of The Barrel
Posts
6,102
Apply the same logic you already have there and mod hh against 24.

Join Date
Feb 2004
Location
New Zealand
Posts
1,482
me feel like a Blond

thanks

Join Date
Feb 2004
Location
New Zealand
Posts
1,482
heres the finish code

Code:
```Function MintoHrs(num)
If num < 60 Then
MintoHrs = "00:" & DIG(num)
Else
hh = Int(num / 60)
temp = (hh * 60)
dd = Int(hh / 24)
If dd > 0 Then
hh = hh - (dd * 24)
dd = dd & "D:"
Else
dd = ""

End If

MintoHrs = dd & DIG(hh) & ":" & DIG((num - temp))
End If
End Function```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•