I\'ve got code that does time tracking for employees. It creates a counter to show the employee how long they have been clocked in for.
This is the current code:
Or, more readably:
diff = datetime_1 - datetime_2 diff * 1.days # => difference in seconds; requires Ruby on Rails
Note, what you or some other searchers might really be looking for is this:
diff = datetime_1 - datetime_2 Date.day_fraction_to_time(diff) # => [h, m, s, frac_s]