comparing datetime with date

Graeme Matthew graeme.matthew at contrado.com.au
Tue Sep 14 20:36:47 EDT 2004


yes it was late, apologies therefore a simple way to solve this problem 
would be:

str(x) == str(y)

:=-)

"Sam Holden" <sholden at flexal.cs.usyd.edu.au> wrote in message 
news:slrnckf3e5.ptn.sholden at flexal.cs.usyd.edu.au...
> On Wed, 15 Sep 2004 09:24:03 +1000,
> Graeme Matthew <graeme.matthew at contrado.com.au> wrote:
>> This is very interesting because if you continue further and coerce both 
>> to
>> strings you get:
>>
>>>>> print str(y) == str(y)
>> True
>
> Of course if you actually do:
>
>>>>> print str(x) == str(y)
>> False
>
>
>>>>> str(y)
>> '2004-09-14 06:43:15'
>>>>> str(x)
>> '2004-09-14'
>>>>>
>>
>> Even though there string values are different they still match?
>
> No, they only matched becuase you compared y with y :)
>
>
> -- 
> Sam Holden 





More information about the Python-list mailing list