py3k: datetime resolution / isoformat

spam at uce.gov spam at uce.gov
Fri Feb 25 21:21:12 EST 2011


When I do:

     datetime.datetime.now().isoformat(' ')

I get the time with the microseconds. The docs says:
"if microsecond is 0 YYYY-MM-DDTHH:MM:SS+HH:MM".

How do I set microsecond to 0?

      >>> datetime.datetime.microsecond = 0
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: can't set attributes of built-in/extension type 
'datetime.datetime'


     >>> datetime.datetime.resolution = (0, 0, 0)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: can't set attributes of built-in/extension type 
'datetime.datetime'

Do I need to create my own class to extend datetime.datetime?

-- 
Yves.                                                  http://www.SollerS.ca/
                                                        http://blog.zioup.org/



More information about the Python-list mailing list