KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am sure this is a nobrainer for a lot of you, but I find myself really confused with the whole datetime.timedelta thing. Essentially I timestamp something when I start startTime and then I timestamp the end of the process endTime and I am trying to get the difference in HH:MM:SS and am having no luck. I get this error when I do print endTime - startTime : TypeError: unsupported operand type(s) for -: 'datetime.time' and 'datetime.time' Edited to include final result: startTime = datetime.now() <... my looping process ...> endTime = datetime.now() calcdTime = endTime - startTime print str(calcdTime)[:-4] This outputs to: H:MM:SS.MM (thus stripping the last 4 characters off the timedelta
Tags (comma-separated)
Save Edits
Cancel