newbie printing question

Paul Winkler slinkp23 at yahoo.com
Tue Oct 16 13:23:27 EDT 2001


On Tue, 16 Oct 2001 08:29:30 -0500, adina_levin at mindspring.com
<adina_levin at mindspring.com> wrote:

>this is the catch:
>
>TimeNow=mxDateTime.now()
>
>TimeNow is a DateTime object, not a string.

>>> date = mx.DateTime.now().strftime('%d-%m-%y')
>>> date
'16-10-01'

Or you could use the attributes of a DateTime object. They're
integers, though.

>>> now = mx.DateTime.now()
>>> date = '-'.join([`now.day`, `now.month`, `now.year`])
>>> date
'16-10-2001'

HTH,

PW



More information about the Python-list mailing list