Standard class for time *period*?
Thomas Passin
list1 at tompassin.net
Mon Mar 27 13:25:22 EDT 2023
On 3/27/2023 11:34 AM, rbowman wrote:
> On Mon, 27 Mar 2023 15:00:52 +0200, Loris Bennett wrote:
>
>
>> I need to deal with what I call a 'period', which is a span of time
>> limited by two dates, start and end. The period has a 'duration',
>> which is the elapsed time between start and end. The duration is
>> essentially a number of seconds, but in my context, because the
>> durations are usually hours or days, I would generally want to display
>> the duration in a format such as "dd-hh:mm:ss"
>
> https://www.programiz.com/python-programming/datetime
>
> Scroll down to timedelta. If '14 days, 13:55:39' isn't good enough you'll
> have to format it yourself.
I second this. timedelta should give the OP exactly what he's talking
about.
More information about the Python-list
mailing list