Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
Loris Bennett
loris.bennett at fu-berlin.de
Wed Apr 20 02:18:00 EDT 2022
Random832 <random832 at fastmail.com> writes:
> On Tue, Apr 19, 2022, at 07:11, Loris Bennett wrote:
>> I now realise that timedelta is not really what I need. I am
>> interested solely in pure periods, i.e. numbers of seconds, that I
>> can convert back and forth from a format such as
>
> A timedelta *is* a pure period. A timedelta of one day is 86400
> seconds.
>
> The thing you *think* timedelta does [making a day act as 23 or 25
> hours across daylight saving boundaries etc], that you *don't* want it
> to do, is something it *does not actually do*. I don't know how this
> can be made more clear to you.
I have now understood this.
> timedelta is what you need. if you think it's not, it's because you're
> using datetime incorrectly.
It is what I need. It just doesn't do the trivial format conversion I
(apparently incorrectly) expected. However, I can implement the format
conversion myself.
[snip (35 lines)]
--
This signature is currently under construction.
More information about the Python-list
mailing list