Victor Engle <[email protected]> writes:
> It would be convenient if datetime.date.today() accepted an argument
> as an offset from today, like datetime.date.today(-1). Is there an
> easy way to do this with datetime?
The types defined in ‘datetime’ can perform calendar arithmetic::
import datetime
today = datetime.date.today()
one_day = datetime.timedelta(days=1)
yesterday = today - one_day
tomorrow = today + one_day
<URL:http://docs.python.org/3/library/datetime.html#datetime.timedelta>
--
\ “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
--
https://mail.python.org/mailman/listinfo/python-list