Use this function to calculate the absolute time difference in hours between two times. The system returns an integer value, rounded down to the number of whole hours.
DiffHours (Time1, Format1, Time2, Format2)
Parameter |
Description |
Time1 |
Enter a time string. The system assumes this time string is in the format specified by the Format1 parameter. The default is the current time. |
Format1 |
Enter a time format string that describes the Time1 parameter. The default is time format 1 (HH:MM:SS). |
Time2 |
Enter a time string. The system assumes this time string is in the format specified by the Format2 parameter. The default is the current time. |
Format2 |
Enter a time format string that describes the Time2 parameter. The default is time format 1. |
The difference between two times is always positive. It does not matter which time string is larger.
Here are some examples:
(Assume the current time is 10:30:10 AM)
Function |
Result |
Explanation |
Return(DiffHours ("09:30:00 AM",2)) |
1 |
The given time is in format 2. The difference in hours between 9:30:00 AM and the current time is one hour. |
Return(DiffHours ("10:30:00 AM",2)) |
0 |
The given time is in format 2. The difference in hours between 10:30:00 AM and the current time is zero. |
© Copyright 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices