. Advertisement .
..3..
. Advertisement .
..4..
I am trying to get last 24 hour python use datetime but I have not found the best way to resolve it yet. Can someone share with me some suggestions?
When using datetime. Here is a suggestion for youfrom datetime import datetime, timedelta
last_hour_date_time = datetime.now() - timedelta(hours = 24)
print(last_hour_date_time.strftime('%Y-%m-%d %H:%M:%S'))
1 Answer