format_datetime

format_datetime(dt: datetime, dp: int = 0) str[source]

Convert a datetime to a formatted string representation.

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

Parameters:
  • dt -- Python datetime.

  • dp -- A number of decimal places for microseconds (0=do not show).

Returns:

Formatted string representation of datetime.