Date strftime('%d%m%y') date to be of yesterday

baboucarr sanneh sanneh27 at hotmail.com
Thu Oct 22 06:46:58 EDT 2009



Hi tim 

Thank you very much ...I have got it now..now i can continue with the backup script i want to make

$LIM $H at DY



> Date: Thu, 22 Oct 2009 11:36:50 +0100
> From: mail at timgolden.me.uk
> CC: python-list at python.org
> Subject: Re: Date strftime('%d%m%y') date to be of yesterday
> 
> baboucarr sanneh wrote:
> > 
> > Hi tim,
> > 
> > well i tried what your script but i do have an error
> >>>> import datetime
> >>>> yesterday = datetime.date.today () - datetime.timedelta (days=1)
> >>>> print yesterday.strftime ("%d%m%y")
> > SyntaxError: invalid syntax (<pyshell#2>, line 1)
> > 
> > when i jus check the variable i.e yesterday i do get the out put but its in a different format
> > datetime.date(2009, 10, 21)
> > it seems like the conversion that is where the error is coming form 
> > 
> > I want it to be like 211009 
> > 
> > Thank you
> 
> 
> I assume you're running Python 3.1? Try this:
> 
> print (yesterday.strftime ("%d%m%y"))
> 
> TJG
> -- 
> http://mail.python.org/mailman/listinfo/python-list
 		 	   		  
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091022/1cd59a62/attachment.html>


More information about the Python-list mailing list