Der findes ikke direkter en function TimeDiff og DateDiff returnere enten antal timer eller antal minutter. Prøv at kikke på dette eks men en timerFunction:
<html> <head> </head> <body> <% sStartTime = \"14:00\" sEndTime = \"16:23\" sMinutesInWords = TimeCalc(\"database\", sStartTime, sEndTime) response.write sMinutesInWords %> </body> </html> <% function TimeCalc(Display, StartTime, FinishTime) Dim diff, mins, hours diff = datediff(\"n\",StartTime,FinishTime) \' set the hours ignoring the remaining fraction hours = int(diff / 60) \' set the minutes by using the remaining fraction and multiplying by 60 i.e., .5 * 60 = 30 mins = round(60*(diff / 60 - hours),0) hours = string(2-len(hours),\"0\") & hours mins = string(2-len(mins),\"0\") & mins
\' how do we want to return the calculation..? select case lcase(Display) case \"screen\" TimeCalc = hours & \" hours and \" & mins & \" minutes\" case \"database\" TimeCalc = hours & \":\" & mins end select end function %>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.