convert minutes into hours and minutes with classic asp
I would like to convert minutes into hours and minutes with classic asp
Example:
90
would
1 hour开发者_运维问答 and 30 minutes
How would I do this in classic ASP
Thanks!
Like this?
function toHourMin(minutes)
hours = minutes \ 60
minutes = minutes mod 60
toHourMin = hours & iif(hours=1," hour"," hours") & " and " & minutes & iif(minutes=1," minute"," minutes")
end function
function iif(condition, truepart, falsepart)
if condition then
iif = truepart
else
iif = falsepart
end if
end function
Note that this will return output like:
0 hours and 0 minutes
If that isn't desired behaviour, you should state what should happen when you pass in differing (smaller) amounts of time.
Passing in 90
will return what you asked for:
1 hour and 30 minutes
精彩评论