My database stores datetime as UTC epoch. I want to filter for a specific date. How can I get the epoch UTC time for the start and end time of that date?
I tried this, but it returns the epoch for the local time (Eastern).
def toEpoch(dt):
return (dt - datetime.datetime(1970,1,1)).total_seconds()
def getTodayStartEpoch():
td = datetime.date.today()
dt = datetime.datetime(td.year, td.month, td.day, 0, 0, 0)
return toEpoch(dt)