The Python time.strftime
docs say:
When used with the strptime() function, the
%p
directive only
affects the output hour field if the%I
directive is used to parse
the hour.
Sure enough, changing your %H
to %I
makes it work.
More Related Contents:
- Get date from week number
- A faster strptime?
- Parsing datetime strings containing nanoseconds
- How to format date string via multiple formats in python
- Convert python datetime to epoch with strftime
- How to parse dates with -0400 timezone string in Python?
- Creating a range of dates in Python
- How do I calculate the date six months from the current date using the datetime Python module?
- Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone
- datetime dtypes in pandas read_csv
- Generate a random date between two other dates
- How do I get the UTC time of “midnight” for a given timezone?
- Print all day-dates between two dates [duplicate]
- How can I filter a date of a DateTimeField in Django?
- Python datetime object show wrong timezone offset
- How to add delta to python datetime.time?
- Convert timedelta to total seconds
- Python datetime to string without microsecond component
- How can I convert 24 hour time to 12 hour time?
- ISO to datetime object: ‘z’ is a bad directive [duplicate]
- Converting between datetime and Pandas Timestamp objects
- unexpected results converting timezones in python
- parameter unsupported when inserting int in sqlite
- NameError: name ‘datetime’ is not defined
- Specifying date format when converting with pandas.to_datetime
- How to monkeypatch python’s datetime.datetime.now with py.test?
- How to get the seconds since epoch from the time + date output of gmtime()?
- Datetime conversion – How to extract the inferred format?
- Parsing a date that can be in several formats in python
- What values are valid in Pandas ‘Freq’ tags?