[Zope3-dev] Dates and times

Tim Peters tim@zope.com
Fri, 15 Nov 2002 14:37:10 -0500


[Tim]
> What's the value of
>
>     2000-01-31 + 1 month
>
> ?  The last day of February?  If so, is
>
>     (2000-01-31 + 1 month) - 1 month
>
> then 2000-01-29?

[anonymous correspondent -- thanks!]
> Yes, that's what PostgreSQL 7.2 comes up with :
>
> select (date('2000-01-31') + interval '1 month') - interval '1 month';
>
>          ?column?
> ------------------------
>   2000-01-29 00:00:00-06

The lesson I take is that I'll no longer pay any attention to complaints
about floating-point roundoff errors <wink>.