I can easily get the yesterday date like this:
from datetime import datetime, timedelta
yesterday = datetime.now() - timedelta(1)
x= datetime.strftime(yesterday, '%Y-%m-%d')
How can I do the same for Unix Epoch time? I tried this:
>>> x=(datetime.now() - timedelta(1)).strftime('%Y, %m, %d')
>>> print(x)
2021, 12, 26
>>> datetime = datetime.date(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: an integer is required (got type str)
I could go now to some crazy conversions, to convert str to int and so on, but that really seems like complete overkill. Recon, there's gotta be a simpler way to do this?
Thanks!