format_timedelta

format_timedelta(td, dp=0)[source]

Convert a timedelta to a formatted string representation.

Convert a Python timedelta object into a string representation, including microseconds to the requested precision.

Args

td: A timedelta object. dp: A number of decimal places for microseconds (0=do not show).

The number should be natural number with 0.

Returns:

Formatted string representation of timedelta.

Parameters:
  • td (timedelta)

  • dp (int)

Return type:

str