format_datetime

format_datetime(dt, dp=0)[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 (datetime) -- Python datetime.

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

Returns:

Formatted string representation of datetime.

Return type:

str