Hello query experts,
I want to create a query that lists “recenty created” and “recently modified” pages, i.e. pages (not blocks) with created-at
or modified-at
during the last couple of days. I thought that this should work:
#+BEGIN_QUERY
{
:title "Recently created"
:query [
:find (pull ?h [*])
:in $ ?start
:where
[?h :block/created-at ?d]
[(>= ?d ?start)]
]
:inputs [:3d]
:collapsed? false}
#+END_QUERY
However, this returns a table with all pages, not just the the ones that were created in the last three days.
So, what’s wrong with the query?
UPDATE: I now understand that :3d
returns a YYYYMMDD
timestamp (e.g. 20220206) whereas the :block/created-at
uses UNIX timestamps (e.g. 1642588328484). That explains why the query above returns all pages this way. So, how do I get around this? Is it somehow possible to convert between the formats? Or is there a way to get the current time in UNIX format into :inputs
?