Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

Dennis Lee Bieber wlfraed at ix.netcom.com
Sat Apr 16 18:22:31 EDT 2022


On Sat, 16 Apr 2022 20:35:22 -0000 (UTC), Jon Ribbens
<jon+usenet at unequivocal.eu> declaimed the following:

>I can categorically guarantee you it is not. But let's put it a
>different way, if you like, if I want to add 24 hours, i.e. 86,400
>seconds (or indeed any other fixed time period), to a timezone-aware
>datetime in Python, how do I do it?  It would appear that, without
>converting to UTC before doing the calculation, you can't.
>

	Which is probably the recommended means to do just that. UTC is an
international standard (call it a zero-reference). All other time-zones
(and daylight savings time) tend to be local/civil time entities (even if
widely accepted), subject to change by whim of the government (consider,
just in the US alone, there are some states, or even parts of states, that
do not honor the DST change over [I really don't know how my watch would
handle some of those, since it time-syncs with WWV-B, including shifting to
DST when WWV-B includes the flag in its broadcast]). And proposals to make
DST permanent year round -- so "noon" (1200hrs) is not "noon" (sun at
zenith) pretty much anywhere.

	The only thing that is most noticeable about UTC is the incorporation
of leap-seconds.


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list