datetime subtract hours python code example
Example 1: python datetime subtract seconds
import datetime
X = 65
result = datetime.datetime.now() - datetime.timedelta(seconds=X)
Example 2: subtract one hour from datetime python
from datetime import datetime, timedelta
d = datetime.today() - timedelta(hours=0, minutes=50)
d.strftime('%H:%M %p')