print '\nDifference between 2 datetime instances:'
creation_date = datetime.datetime(2006,12,31,0,12,44)
todays_date = datetime.datetime(1900,1,1).today()
target_date = datetime.datetime(1900,1,1).today() - datetime.timedelta(5)
 
print 'creation_date =', creation_date
print 'todays_date =', todays_date
print 'target_date =', target_date
 
print
print todays_date - creation_date
print todays_date - target_date
 
if creation_date > target_date:
 print "Greater"
elif creation_date < target_date:
 print "NOT Greater"
else:
 print "The dates are equal"
 
Sample output:
Difference between 2 datetime instances:
creation_date = 2006-12-31 00:12:44
todays_date = 2007-01-05 10:20:16.281000
target_date = 2006-12-31 10:20:16.281000
 
5 days, 10:07:32.281000
5 days, 0:00:00
The dates are equal