是的,您可以有一个复选框NextDay来标记结束时间是否是第二天。
那么你的时间跨度将是:
Dim Timespan As Date
Timespan = CDate([EndTime] - [StartTime] + Abs([NextDay]))
输入时间可以用这里的方法:输入24小时制
要格式化和显示您的时间跨度,也适用于 24 小时以上的值,请使用如下函数:
Public Function FormatHourMinute( _
ByVal datTime As Date, _
Optional ByVal strSeparator As String = ":") _
As String
' Returns count of days, hours and minutes of datTime
' converted to hours and minutes as a formatted string
' with an optional choice of time separator.
'
' Example:
' datTime: #10:03# + #20:01#
' returns: 30:04
'
' 2005-02-05. Cactus Data ApS, CPH.
Dim strHour As String
Dim strMinute As String
Dim strHourMinute As String
strHour = CStr(Fix(datTime) * 24 + Hour(datTime))
' Add leading zero to minute count when needed.
strMinute = Right("0" & CStr(Minute(datTime)), 2)
strHourMinute = strHour & strSeparator & strMinute
FormatHourMinute = strHourMinute
End Function