Filtering collection on capture date, but by month only

I’m working on a project for which I want to show all the photos I’ve captured in a particular month, regardless of the year. For example, show me all the files captured in July, whether it’s 2025, 2024, 2023, etc. But the filter rule in darktable tells me that the year is mandatory, which won’t work for me in this case. Can anyone suggest a hack or workaround to filter on month only, without having to manually include every possible year?

Dave

1 Like

I don’t think there is one.

darktable’s backing database is sqlite3. There isn’t a timestamp data type, so all timestamps are stored as integer seconds since 01/01/1970.

To select all the images taken in a specific month from the database would be

select * from images where strftime("%m", datetime_taken) = '0x'; where x is the number of the month.

There’s not a way to enter sql queries into the collection rules at this time though it might be a nice to have feature for cases like this.

2 Likes

I would love this feature! I’ve been working on a lua script to help me organize my photos in different ways for the purposes of cleaning up my own mess. Being able to query against the sqlite db would make quirky cases like this so much easier to handle and probably be faster/more efficient.

Though I understand there’s a lot of implications in allowing lua scripts to query the database…

1 Like

Thanks. I guess I’ll just do it the manual way.

I added a feature request, Add SQL where statement to collection rules · Issue #19155 · darktable-org/darktable · GitHub

2 Likes

I like the presented use-case, as I sometimes do that same during my yearly calendar image selection process. I’m usually quite strict when selecting pictures for a certain month, a candidate picture should be ideally captured in the same month it is going to be appear in the calendar ±1month tolerance.

I think we could cater to this very use-case in the “collection filter” section by adding a new rule “capture month” which let’s you select multiple months from an array of month fields. Is that how you would like to search for pictures taken in (a) certain month(s)?

FYI, in the meantime I created a draft PR which adds the functionality to filter by capture month: #20697
Feel free to try it out and give some feedback.