Based on the current time (datetime.now()
) I want to expand this to cover the whole days time.
Right now I have been using:
start = (datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S')
end = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
Problem is that this is 24 hours from the current date. If it is 12pm noon that means it should only look back 12 hours as I want to search for the current days records.
How can I accomplish this in Python?