Smarter formatting of timedelta and datetime columns

Closes #3401 
Closes #5708
Closes #5912