HourDiff

Returns the precise hour count between given dates. A date with no time specified counts as the very beginning of that day, ie. 0:00 AM. Return value can be negative.

Syntax

HourDiff("dateFrom","dateTo");

Function arguments

  • dateFrom – (String) The first date.
  • dateTo – (String) The second date.

Return value

This function returns Decimal.
Returns precise value (whole and fractional) of hours between two dates.

Examples

Example 1:
This will return 34 hours.

HourDiff( "1999-10-04 8:30", "1999-10-05 18:30");

Example 2:
This will return -34 hours.

HourDiff( "1999-10-05 8:30", "1999-10-04 18:30");

Example 3:
This will return 1.5 hours.

HourDiff( "1999-10-04 8:30", "1999-10-04 10:00");
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.