Anki Forums

What code should I use on Debug Console to get the hour and minute I answered every card today (to be more precise, I just want the first and last time I answered a card today)?

If I paste the following code on Anki’s Debug Console (Ctrl + Shift + ;), I get a log containing all the dates and times I answered a card.

import datetime
cmd = f"select ease, id from revlog ORDER BY id ASC "
a = mw.col.db.all(cmd)
for index, element in enumerate(a):
    print(datetime.datetime.fromtimestamp(element[1]/1000).strftime('%a-%d-%b-%Y, %H:%M %p'))

What code should I use to get the times I answered every card just today (to be more precise, I just want the first and last time I answered a card today(1))?

(1) For today I mean the cards scheduled for today. That’s because sometimes I study overnight, so I may answer cards after midnight that were scheduled for the previous day. (e.g. Day1: First card: 23:30 p.m. [of day 1] - Last card: 00:30 a.m. [of day 2]; Day 2: First card: 14:00 p.m. - Last card: 16:30 p.m. I don’t want the last card answered from Day 1 to be taken as first card of Day 2)