[Dev] blog post on why date math is *fun* (unless your a PHP
coder)
Grant Baillie
grant at osafoundation.org
Thu Nov 3 11:39:30 PST 2005
On Nov 3, 2005, at 10:39, Phillip J. Eby wrote:
> At 01:27 AM 11/3/2005 -0500, Mike Taylor wrote:
>> Just thought I would share the blog post with other devs -
>> something to always keep in the back of your brain when
>> manipulating dates :)
>>
>> http://www.alexking.org/blog/2005/11/02/nasty-php-oddity/
>
> FWIW, in Python you should use a timedelta(days=whatever) to move
> by days. That's why timedelta keeps the days separate from the
> seconds and such. (That is, because there are days that aren't
> 86400 seconds long.)
More generally, doing arithmetic directly on datetime fields (as
opposed to using timedelta) is usually a bad idea. For example, see
<https://bugzilla.osafoundation.org/show_bug.cgi?id=4367>
--Grant
More information about the Dev
mailing list