Jan-27-2023, 03:36 PM
Hello,
What's a good way to get an Epoch timestamp without the milliseconds?
What's a good way to get an Epoch timestamp without the milliseconds?
for row in cur.execute("SELECT id,created,title FROM content"): #2004-08-18 19:11:13 formated_date = datetime.strptime(row["created"],"%Y-%m-%d %H:%M:%S") epoch = datetime.timestamp(formated_date) #BAD epoch = datetime.datetime.timestamp(formated_date).replace(microsecond = 0) #2004-08-20 13:15:42 1093000542.0 Some title print(row["created"], epoch, row["title"])Thank you.