Returning Date As String ?

Brian Beck exogen at gmail.com
Sat May 14 15:24:27 EDT 2005


Peter Moscatt wrote:
> I am wanting to return the system date using the following:
> 
> 	date.today()
> 
> How would I then convert this to a string ?

Use the strftime method. The formatting directives are documented here:
http://docs.python.org/lib/module-time.html

Example: date.today().strftime("%B %d, %Y")

-- 
Brian Beck
Adventurer of the First Order



More information about the Python-list mailing list