get "yesterday's" date in iso format

necromancer_stupidspambot at quanta1.world-vr_stupidspambot.com necromancer_stupidspambot at quanta1.world-vr_stupidspambot.com
Fri Jan 23 22:29:42 EST 2004


On Fri, 23 Jan 2004 17:54:15 +0100, Gerrit Holl wrote:

> 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

Excellent. I guess I skipped the timedela section of the datetime module.

Thanks a lot,
David





More information about the Python-list mailing list