ExcelVBAで時間差分

    Dim startDate As Date
    Dim endDate As Date
    startDate = "2018/10/10 12:00:00"
    endDate = "2018/10/10 18:30:50"
    
    '差を表示
    Debug.Print "時分秒の差分は、それぞれ以下のとおりです。"
    Debug.Print "--------------------------------------------"
    Debug.Print DateDiff("h", startDate, endDate) & "時間"
    Debug.Print DateDiff("n", startDate, endDate) & "分"
    Debug.Print DateDiff("s", startDate, endDate) & "秒"
    Debug.Print "--------------------------------------------"