BUG: Fix to_dict() problem when using datetime DataFrame #11247
closes #11247

This is my first time contributing through PR so forgive me if I make any silly mistake.
The issue can be referred to in GH11247
I followed @jreback 's suggestion to box things up in `to_dict()` but I am not sure if this is what he means because I do not know exactly when `_maybe_datetime()` should be used. Initially I tried to tweak `internals.py` but it fails.

Let me know how I can improve from here. Hope I can really learn from my first PR.
