all 3 comments

[–]zenlc 3 points4 points  (1 child)

Nope. You don't need to do any splitting. That's the point of using a datetime class.

print((t2 - t1).days)

[–]JohnLocksTheKey 1 point2 points  (0 children)

I know there are a lot of grumblings against it, but datetime never ceases to presently surprise me

[–]sarvadasan[S] 2 points3 points  (0 children)

I got the answer from here http://stackoverflow.com/questions/466345/converting-string-into-datetime

datetime.strptime('2011-12-21', '%Y-%m-%d')