Using human_readable_duration()

Looking to use the human_readable_duration() in WordPress 5.1+? Here’s a guide on how you can call an hour, minute or second in a human-readable format.

How to call human_readable_duration()

In order to use the human_readable_duration(), you need to understand how it works first.

Hours, minutes and seconds are separated by colons within the function’s attributes, as per the example below:

echo human_readable_duration( '10:20:30' );

Meaning, the above function will output 10 hours, 20 minutes, 30 seconds.