Why are my two date fields not identical when I copy them?

Posted by Hobhouse on Stack Overflow See other posts from Stack Overflow or by Hobhouse
Published on 2010-04-27T10:34:14Z Indexed on 2010/04/27 10:43 UTC
Read the original article Hit count: 190

Filed under:
|
|

I use django, and have two models with a models.DateTimeField(). Sometimes I need a copy of a date - but look at this:

>>>myobject.date = datetime.datetime.now()
>>>print myobject.date
>>>2010-04-27 12:10:43.526277

>>>other_object.date_copy = myobject.date
>>>print other_object.date_copy
>>>2010-04-27 12:10:43

Why are these two dates not identical, and how do I make an excact copy of myobject.date?

© Stack Overflow or respective owner

Related posts about python

Related posts about django