getting system date

Dan Bishop danb_83 at yahoo.com
Sat May 10 16:26:54 EDT 2003


"Tim Heaney" <heaney at cablespeed.com> wrote in message news:<87znlusu5s.fsf at mrbun.watterson>...
> "Psybar Phreak" <psybar_phreak at yahoo.com> writes:
> > 
> > im using python cgi in my website, and wanted to get the system date in the
> > format YYYY-MM-DD
> 
> How about strftime in the time module?
> 
>   $ python -c 'import time; print time.strftime("%Y-%m-%d")'
>   2003-05-10

Another way (that only works in 2.3) is

import datetime
print datetime.date.today()




More information about the Python-list mailing list