Moved duration formatting into a function and now supports hours.