How to Calculate the Date & Time Difference in Hours & Minutes in VBA

Written by ryan menezes

Share

Tweet

Share

Pin

Email

Visual Basic calculates the time between appointments. (Jupiterimages/Photos.com/Getty Images)

Visual Basic computes dates using the DateTime structure. A DateTime variable stores a time in terms of its year, month and day, its hour, minute and second and even its milliseconds. A command that acts on DateTime variables, the DateDiff function, calculates the difference between the two times. It returns this difference in terms of whichever interval you specify, including days and years or hours and minutes.