This is an attempt at solving the problem of formatting the difference between two points in time in a manner similar to the strftime()
function. It was based on a discussion about PBoL
The problem is; given a start date and time, and an end date and time, format a string with values showing the difference in years, months, days, hours, minutes, and seconds between the two.
Because months and years contain a varying number of days, we cannot simply compute these from difftime()
For instance, the difference between Jan 31st and Mar 1st is sometimes 29 days, sometimes 30 days, but always one month and one day. The difference between Jul 2nd and Aug 1st is 30 days, but not a month.
For a more detailed description of the problem, check this blog post
is a low-level function that does the actual work of computing the time difference between two tm
provide formatted output of the time difference between two tm
provide a more generic textual representation.