I\'m trying to get my head around the datetime module. I know the time now as an epoch and the time an event last happened (as an epoch time). What I need to do is figure
To get the specific timezone's midnight timestamp:
from datetime import datetime import pytz TZ = "Asia/Shanghai" datetime.now(pytz.timezone(TZ)).replace(hour=0, minute=0, second=0, microsecond=0).timestamp()