Ben Finney ben+python at
Wed Mar 26 22:36:42 CET 2014

Victor Engle <victor.engle at> writes:

> It would be convenient if accepted an argument
> as an offset from today, like Is there an
> easy way to do this with datetime?

The types defined in ‘datetime’ can perform calendar arithmetic::

    import datetime

    today =
    one_day = datetime.timedelta(days=1)
    yesterday = today - one_day
    tomorrow = today + one_day


 \        “Most people, I think, don't even know what a rootkit is, so |
  `\     why should they care about it?” —Thomas Hesse, Sony BMG, 2006 |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list