VBA:日期时间 转班次

日期时间格式 转自定义班次

Function banci(dt As Date) As String
    'If (Hour(dt) >= 0 And Hour(dt) < 8) Then
    If Format(dt, "hh:mm:ss") >= "00:00:00" And Format(dt, "hh:mm:ss") < "08:00:00" Then
    banci = Format(VBA.DateAdd("d", -1, dt), "mmdd")
    Else
    banci = Format(dt, "mmdd")
    End If
End Function