what do I have to do,so the function returns the correct result when the end of the worktime passes midnight?
Public Function HoursAndMinutes(interval as variant) as string
dim totalminutes as long, totalseconds as long
dim hours as long, minutes as long, seconds as long
if isnull(interval)= true then exit function
hours = Int(CSng(interval*24))
totalminutes = Int(CSng(interval*1440))
minutes = totalminutes mod 60
totalseconds =Int(CSng(interval*86400))
seconds = totalseconds mod 60
if seconds>30 then minutes = minutes+1
if minutes>59 then hours = hours+1:minutes=0
HoursAndMinutes = hours & ":" & format(minutes, "00")
End function
for an example starttime endtime function return totalwork
22:30 02:30 -20:00
I want to see 04:00
Thanks for help