Get the current date, python 2.2

nano nano at nano.ono
Fri Jun 15 17:46:20 EDT 2007


In article <KJSdnfIyZopSm-7bRVnyjwA at pipex.net>, rtw at freenet.co.uk 
says...
> On Fri, 15 Jun 2007 14:30:36 -0700, nano wrote:
> 
> > Using python 2.2 what is the simplest way to get the current date value?
> > I have looked in so many places. The question is often asked and the
> > usual response indicates how to get the current date and time like
> > 
> > now = time.localtime()
> > 
> > I want just the date, like 2007-06-15. The value will go into a
> > postgresql Date type column.
> 
>  >>> import datetime
>  >>> d = datetime.date.today()
>  >>> d.isoformat()
>  '2007-06-15'
>  >>> 
>  
> Rob.
> 
Thanks, I'd read that today() was only good for 2.3? 



More information about the Python-list mailing list