fixing to_datetime returns KeyError: 'p' when %p specified in format string

fixing https://github.com/pydata/pandas/issues/5361