# Beeminding time spent reviewing Anki cards

**URL:** <https://forum.beeminder.com/t/beeminding-time-spent-reviewing-anki-cards/12358>\
**Category:** Tech\
**Created:** [May 11, 2025, 10:36pm UTC](https://forum.beeminder.com/t/beeminding-time-spent-reviewing-anki-cards/12358 "2025-05-11T22:36:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![forrestwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/forrestwolf/32/4685_2.png) [@forrestwolf](https://forum.beeminder.com/u/forrestwolf)\
**Post date:** [May 11, 2025, 10:36pm UTC](https://forum.beeminder.com/t/beeminding-time-spent-reviewing-anki-cards/12358/1 "2025-05-11T22:36:09Z")

</div>

At one point I wanted to Beemind total time spent reviewing Anki cards, which IIRC isn’t something that the integration supports. The Anki app shows the time spent _today_, so I knew that information was already in there, but

- I sometimes forgot to enter data on a given day, and there wasn’t an obvious way to see how much time I’d spent on it in a _past_ day

- If I remembered to enter data during a day, I might review more cards later, so the datapoint would need to be updated - inconvenient

- This also pushed me towards doing the data entry later which made me more likely to forget entirely

So I looked into how Anki comes up with that number for time spent, and wound up building this script:

```bash

sqlite3 ~/Library/Application\ Support/Anki2/User\ 1/collection.anki2 -column "SELECT ROUND(CAST(SUM(time) AS FLOAT)/3600000, 2), date(id / 1000, 'unixepoch') as date FROM revlog WHERE date > '2025-04-02' GROUP BY date ORDER BY date;" | sed -r 's/([0-9\.]+) +([0-9]+)-([0-9]+)-([0-9]+)/\2 \3 \4 \1 \"anki\"/'

```

The `2025-04-02` there is the start date; when I run this, I replace that with the date I _last_ ran it, so as to not duplicate data points from last time. The rest of the sql code is basically totalling up card review times for each day, and the `sed` command transforms the output into a format that I can paste into the ‘Advanced Entry’ on the Beeminder website.

Edit: it’s giving times in fractions of an hour because that’s how I set up the goal (for reasons outside the scope of this post); if you want a number in minutes, you can of course just change the divisor.

Obviously this is still partly manual and _could_ be automated or streamlined further, but it lets me enter data for a bunch of days in one go, so I think I’ve pretty much picked the low handing fruit here

…and despite having searched the forum for a way to do this _before_ building my own, it was only afterward that I found [this post](https://forum.beeminder.com/t/anki-addon-to-beemind-cards-count-and-time-spent/7229/7), which might just be entirely better than what I came up with, but I’m posting here anyway just on the off chance someone finds it useful.

---

<div class="post-metadata">

**Author:** ![philip](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/philip/32/1505_2.png) [@philip](https://forum.beeminder.com/u/philip)\
**Post date:** [May 15, 2025, 12:46pm UTC](https://forum.beeminder.com/t/beeminding-time-spent-reviewing-anki-cards/12358/2 "2025-05-15T12:46:07Z")

</div>

That’s great! Thank you for sharing.

If you change your goal to custom with an aggregation method of ‘max’, then you can not worry about creating duplicate datapoints, or about studying more cards after having made the entries.

If you’re confident that you’ll run this at least every few days, then you could replace the hardcoded date with `DATE('now', '-7 day')` to get the last week’s worth of figures.

---

<div class="post-metadata">

**Author:** ![forrestwolf](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/forrestwolf/32/4685_2.png) [@forrestwolf](https://forum.beeminder.com/u/forrestwolf)\
**Post date:** [May 15, 2025, 9:48pm UTC](https://forum.beeminder.com/t/beeminding-time-spent-reviewing-anki-cards/12358/3 "2025-05-15T21:48:55Z")

</div>

Those are some good ideas.  
I don’t think they fit my use case (it’s actually going into a goal that’s counting time spent on several related activities, and I enter some of the others manually) but for anyone Beeminding specifically Anki time in the future the aggregation method of ‘max’ sounds more convenient.

I had considered setting up a script to pipe the results from this into that Beeminder CLI someone made, and then having a cron job run that, but currently I do it on no fixed schedule.
