get "yesterday's" date in iso format

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Fri Jan 23 05:19:22 CET 2004


On Thu, 22 Jan 2004, necromancer_stupidspambot at quanta1.world-vr_stupidspambot.com wrote:
> I am trying to find a simple way to get "yesterday's" date.

    >>> import datetime
    >>> today = datetime.date.today()
    >>> today
    datetime.date(2004, 1, 23)
    >>> yesterday = today - datetime.timedelta( 1 )
    >>> yesterday
    datetime.date(2004, 1, 22)

-- 
 \      "We must become the change we want to see."  -- Mahatma Gandhi |
  `\                                                                   |
_o__)                                                                  |
Ben Finney <http://bignose.squidly.org/>



More information about the Python-list mailing list