I'm trying to build an app where I can an API request, but I want to send a time query where the time is the time 10 minutes ago. How should I go about doing that in Python?
Something like this should do the trick.
datetime.now(timezone.utc)
Alternatively, you could try this as well. For me, I had to add 5 hours because I'm in EST, so do the respective conversion.
curTime = (datetime.datetime.now() + datetime.timedelta(hours=5)).strftime('%Y-%m-%d %H:%M:%S')
For handling time zones and related conversions, you could have a look at e.g. stackoverflow.com/a/65087160/10197418