With this function you can get the number of hours between two dates. This value is always positive, and incomplete hours will be returned as a fraction.
date_hour_span(date1, date2);
Argument | Type | Description |
---|---|---|
date1 | Datetime | The first datetime. |
date2 | Datetime | The datetime to compare the first one to. |
diff = date_hour_span(date_create_datetime( 2011, 9, 15, 11, 4, 0 ), date_current_datetime());
This would set "diff" to the number of hours between 15th September 2011, 11:04.0 and the current date and time.