Overview
- For a timedelta instance, the function repr() returns a string containing the constructor invocation which is quantitatively equivalent to the original parameter values.
Example
# Example Python program that prints
# a timedelta instance as a call to the constructor
from datetime import timedelta
longestTennisMatch = timedelta(hours=11, minutes=5)
print("Longest tennis match:")
print(repr(longestTennisMatch))
twentyFourPlus = timedelta(hours=24, minutes=10)
print("More than 24 hours:")
print(repr(twentyFourPlus))Output
Longest tennis match:
datetime.timedelta(seconds=39900)
More than 24 hours:
datetime.timedelta(days=1, seconds=600)