[Tutor] <type 'datetime.time'> Variable to String?

wesley chun wescpy at gmail.com
Sat Feb 14 01:43:51 CET 2009


On Fri, Feb 13, 2009 at 3:50 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net> wrote:
> That's pretty much the question in Subject. I've got a date time variable
> with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a string.

>>> import datetime
>>> d = datetime.time(15,0)
datetime.time(15, 0)
>>> d
datetime.time(15, 0)
>>> str(d)
'15:00:00'

is this what you're looking for, or was there something else?
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list