newbie printing question
Steve Holden
sholden at holdenweb.com
Tue Oct 16 13:40:18 EDT 2001
<adina_levin at mindspring.com> wrote in message
news:9qhdpm$ibl$1 at slb7.atl.mindspring.net...
> this is the catch:
>
> TimeNow=mxDateTime.now()
>
> TimeNow is a DateTime object, not a string.
>
[... original "how do I get a string containing mx.DateTime's now() method's
result? ...]
>>> import mx.DateTime as mxdt
>>> now = str(mxdt.now())
>>> print now, type(now)
2001-10-16 13:35:30.91 <type 'string'>
>>>
Of course, you could just as easily store the DateTime value, and use it's
str() method when you needed the string: that way you could use all its
other methods and attributes as well!
>>> now = mxdt.now()
>>> now.calendar
'Gregorian'
>>> now.abstime
49124.919999957085
>>> now.tuple()
(2001, 10, 16, 13, 38, 44.919999957084656, 1, 289, 1)
>>> str(now)
'2001-10-16 13:38:44.91'
>>>
regards
Steve
--
http://www.holdenweb.com/
More information about the Python-list
mailing list