Human Time Difference

and like us on FB

It’s often more appropriate to return a date difference in a human readable string. We’ve posted a version of WordPress’ human_time_diff() function here (to be used outside of WP). However, there are countless means of achieving the same result. The following is a function we also regularly use.

The function accepts any strtotime() compatible time string.

See also our WP snippet: Display Time To Published or Scheduled Posts.