yesterday's date

Matt Setzer dontspamsetzer at nwlink.com
Wed May 9 22:10:58 EDT 2001


    Subtract one day (in seconds) from the value returned by time.time(),
then convert it to a string.

>>> import time
>>> ticks = time.time()
>>> time.asctime(time.localtime(ticks - 24 * 60 * 60))
'Tue May 08 19:08:08 2001'
>>>

"LC" <lco at gofuse.com> wrote in message
news:9dco8r$uno$1 at nntp2-cm.news.eni.net...
> Can someone help or direct me in how I can retrieve the exact date one day
> ahead? For example if today is 05-09-01, how can I find 05-08-01. I've
tried
> subtracting one day but when the date is 05-01-01, I get 05-00-01 instead
of
> 04-30-01. Any information would be appreciated. TIA
>
> Leo Chen
>
>





More information about the Python-list mailing list