Fix formatting for datetime objects.