Subtract n months from datetime [Why?]

MRAB python at mrabarnett.plus.com
Wed Jun 22 13:48:52 EDT 2022


On 2022-06-22 17:59, Paulo da Silva wrote:
> Às 05:29 de 21/06/22, Paulo da Silva escreveu:
> 
> As a general response to some comments ...
> 
> Suppose we need to delete records from a database older than ...
> Today, it's usual to specify days. For example you have to keep some gov
> papers for 90 days. This seems to come from computers era. In our minds,
> however, we immediately think 90 days=3 months.
> For example, one may want to delete some files older than 9 months. It's
> far more intuitive than 270 days.
> When we talk about years it is still going. For example I need to keep
> my receipts for 5 years because IRS audits.
> Accepting this, it's intuitive, for example, that 3 months before July,
> 31 is April, 30.
> The same happens for the years. 5 years before February, 29 is February, 28.
> 
> Again, this is my opinion and that's the way I like it :-)
> 
What makes sense depends on where you're looking from.

It's 28 February, you need to keep it for 5 years, therefore you could 
reason that you can dispose of it on 28 February, 5 years hence.

However, that happens to be a leap year.

Should you still have it on 29 February?


More information about the Python-list mailing list