get "yesterday's" date in iso format

Gerrit Holl gerrit at nl.linux.org
Fri Jan 23 11:54:15 EST 2004


Tim Heaney wrote:
> necromancer_stupidspambot at quanta1.world-vr_stupidspambot.com writes:
> >
> > I am trying to find a simple way to get "yesterday's" date.
> 
> Since time.time() gives the time in seconds since the epoch, you could
> just subtract a day from that to get yesterday.

Even better:

>>> from datetime import date, timedelta
>>> (date.today() - timedelta(1)).day
22

yours,
Gerrit.

-- 
179. If a "sister of a god," or a prostitute, receive a gift from her
father, and a deed in which it has been explicitly stated that she may
dispose of it as she pleases, and give her complete disposition thereof:
if then her father die, then she may leave her property to whomsoever she
pleases. Her brothers can raise no claim thereto.
          -- 1780 BC, Hammurabi, Code of Law
-- 
PrePEP: Builtin path type
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list