Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69148 > unrolled thread
| Started by | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| First post | 2014-03-27 08:36 +1100 |
| Last post | 2014-03-27 08:36 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: datetime Ben Finney <ben+python@benfinney.id.au> - 2014-03-27 08:36 +1100
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2014-03-27 08:36 +1100 |
| Subject | Re: datetime |
| Message-ID | <mailman.8591.1395869819.18130.python-list@python.org> |
Victor Engle <victor.engle@gmail.com> 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
Back to top | Article view | comp.lang.python
csiph-web