Python date time comparison:
For python date time comparison you can directly compare between two date and also make some mathematical operation
For python date time comparison you can directly compare between two date and also make some mathematical operation
import datetime import time before=datetime.datetime.now() print "before "+str(before) time.sleep(5) after=datetime.datetime.now() print "after "+str(after) difference=after-before print "difference "+str(difference)
before 2011-07-21 15:38:13.330000 after 2011-07-21 15:38:18.347000 difference 0:00:05.017000
0 comments:
Post a Comment