How to write query to show blocks with date as today

Before coming to logseq I was using workflowy, I had developed pattern of task management where I search for ‘today’ to see what is pannned for today , tomorrow for tomorrow.

Replicating same in logseq, I tried to write queries to show block having date as today, unsuccessful. Could anyone help me in writing query to select blocks which has date as today mentioned anywhere in block.content?

I am new to closure / datalog, started to us logseq couple of days before.

You should use either a reference to a journal day or the scheduled command.
Then check out this topic:

Otherwise you can give the version 0.9 query builder a try as well.

somehow I was able to build one with having static date in the query, building on top of what given by query builder.

:title [:b "Show blocks with given date"]
:query [:find (pull ?block [*])
[?block :block/content ?blockcontent]
[?block :block/page ?page]
[?page :block/name ?pagename]
( or
[(clojure.string/includes? ?blockcontent "Apr 7")]
[(clojure.string/includes? ?blockcontent "04-07")]

Can someone help in making this dynamic? Like if I visit journal page - of today I see the tasks in that query.

I’m still not quite sure what your content looks like?
Here’s an example:

I have a task which references a journal page (the current one, for the example).
Then on that journal page I have a query that gets all tasks that reference that same journal page.
If your data is different from this, then please specify.


{:title [:b "Show blocks with given date"]
 :query [:find (pull ?block [*])
   :in $ ?current
     [?journal :block/name ?current]
     [?block :block/refs ?journal]
     [?block :block/marker ?mark]
     [(contains? #{"TODO" "DOING" "LATER" "NOW"} ?mark)]
 :inputs [:current-page]