How can I search for a date range?

I’d like to search pictures dated between datetime A and datetime B.
Didn’t find the keywords or syntax :blush:

We are working on a new syntax to allow for exactly that.

For now you can use the very obscure syntax below if it’s urgent. Type the following in the search box (replace the dates to what you need):

media:“datecreated/1000 >= cast(strftime(’%s’,‘2018-01-01’) as int) and datecreated/1000 < cast(strftime(’%s’,‘2019-01-01’) as int);”

Be careful if you copy & paste. A lot of browsers tend to turn the single and double quotes into slanted single or double quotes when you copy, which won’t work inside Mylio. So you may just have to copy this to somewhere else first, then replace the quotes and the dates you need, then paste it in the search box.

1 Like

Cool - I was trying to figure out this exact thing. Wasn’t sure if your current search parser supported functions like strftime(). Looks like it’s basically the SQLite WHERE clause syntax.


1 Like

This is an old topic, but since Google finds it, I thought it would be good to update it with current information. Unfortunately, Mylio’s advanced search info page doesn’t give much in the way of examples. If you want to find photos in a date range, you can use this notation in the search bar:

date:[2021-08-06 to 2021-08-17]

The above will find photos between August 6, 2021 and August 17, 2021.

To find all photos until August 17, 2021, use this notation:
date:[* to 2021-08-17]

To find all photos from August 17, 2021 until now, use this notation:
date:[2021-08-17 to *]


The new syntax is great! Thanks.

Do I find it somewhere in the documentation?

Would it be easier to click date ranges in an calendar instead of writing the syntax?

Are you sure these are valid syntax with the asterisk character? Instead of these, I would use:

date: <= 2021-08-17

date: >= 2021-08-17

Although technically the second one will also find photos with dates IN THE FUTURE (not just up to “now”) - although that’s not something I worry about too much :slight_smile:

The Mylio docs didn’t provide any examples, which was frustrating. I saw they were using the Lucene search engine, so I started searching for posts on Lucene searches and found the above notation somewhere. It seemed to work for me (on a very quick test).

You should also be able to get down into hours, minutes, etc. with the syntax. I wasn’t looking for that level of precision, so I didn’t try it out, nor did I include the syntax. I believe you need to start using colons on the time part.

Thanks @jimre for providing some additional syntax to try.

For me this works as expected:

date:[* to 2021-08-17]

But this does not:

date:[2021-08-17 to *]

The second query returns everything prior to 2021-08-17.

The versions I posted with <= and >= both work as expected.

That’s exactly what I experience (see Search/filter a date range until now). Thanks for confirming this. :grinning_face_with_smiling_eyes:

The order of the two operands on left and right of the TO is irrelevant right now. It will always returns photos between the smaller of the dates and the larger of the dates. That’s why it doesn’t work since * is always the smaller date.

This is fine for actual date values, but obviously for a * it should mean the largest if it’s on the right-hand-side. I’ll change this.