| 時間の切上、切捨 |
| ある時刻からある時刻までの時間計算で10分以下なら切捨てする。または切上げするという計算式です。下記のモジュールを記述してクエリーから呼び出しています。 |
| Public Function timecut(time1, time2) As
String Dim n1 As Integer On Error Resume Next n1 = Int(Format((time2 - time1), "n") * 0.1) * 10 timecut = Format((time2 - time1), "h") & ":" & n1 End Function '-------------------------------------------------------------------- Public Function timeup(time1, time2) As String Dim n As Integer Dim n1 As Integer Dim n2 As Integer On Error Resume Next n = Format((time2 - time1), "n") n1 = Int(Format((time2 - time1), "n") * 0.1) * 10 n2 = (Int(Format((time2 - time1), "n") * 0.1) + 1) * 10 If n1 = n Then timeup = Format((time2 - time1), "h") & ":" & n1 Else timeup = Format((time2 - time1), "h") & ":" & n2 End If End Function |
![]() |