It’s easy to fix after the fact:
from datetime import datetime, timedelta
dt = datetime.strptime(...)
if dt > datetime.now():
dt -= timedelta(years=100)
More Related Contents:
- Converting between datetime, Timestamp and datetime64
- Iterating through a range of dates in Python
- How to construct a timedelta object from a simple string
- Combine Date and Time columns using python pandas
- Parsing date with timezone from an email?
- How to increment datetime by custom months in python without using library [duplicate]
- Can’t subtract offset-naive and offset-aware datetimes
- Convert datetime to Unix timestamp and convert it back in python
- Find the closest date to a given date
- How to increment a datetime by one day?
- Datetime Timezone conversion using pytz
- How to read datetime back from sqlite as a datetime instead of string in Python?
- How to get current time in python and break up into year, month, day, hour, minute?
- Fetching datetime from float in Python
- “import datetime” v.s. “from datetime import datetime”
- How do you convert a datetime/timestamp from one timezone to another timezone?
- How to convert to a Python datetime object with JSON.loads?
- Why does datetime.datetime.utcnow() not contain timezone information?
- Pythonic difference between two dates in years?
- Convert a column of datetimes to epoch in Python
- How to define format when using pandas to_datetime?
- pd.Timestamp versus np.datetime64: are they interchangeable for selected uses?
- pandas bar plot combined with line plot shows the time axis beginning at 1970
- how to test if a variable is pd.NaT?
- Truncate `TimeStamp` column to hour precision in pandas `DataFrame`
- How to create a DateTime equal to 15 minutes ago?
- Keep a datetime.date in ‘yyyy-mm-dd’ format when using Flask’s jsonify
- Why doesn’t pytz localize() produce a datetime object with tzinfo matching the tz object that localized it?
- how to specify the datetime format in read_csv
- Python generating a list of dates between two dates