Allow complete control over date & time formatting in queries, macros & templates

Hi,

This is a feature request for the ability to control the format of the date & time within queries, macros and templates regardless of what our config.edn is set to.

At the moment we are stuck with just the one date format, the one setup in our config.edn. This is very limiting.

We should be able to select any format we want when we need it, select just hour, just seconds, format it this way, yyyyMMddhhmmss for one macro and the next macro yyyy-MM-dd hh:mm

In Logseq I cannot make any template, query, or macro that lets me combine date and time in the page name.

For example, if I have a block property time, I should be able to query it via my own formatter in place.

For example:

type:: exercise
exercise-type:: running-far-and-wide
dt:: 2022_08_23 13:45

In the query/macro/template:

<% date("yyyy_MM_dd hh:mm") %>

I might have another query that does the following:

select all pages with the page title format <% date("yyyyMMddhhmmss") %>
between <% date("yyyy-MM-dd", 2021-08-01) %>
and <% date("yyyy-MM-dd", 2021-10-01) %>

This is querying my pages in zettelkasten format.

I would like to perform all of the above queries without changing any configuration.

Let us pass a date string as a formatter inside a dynamic variable.

Thanks!

I second this. My usage would be to include a URL pointing to Fantastical of a particular date in my daily journal template:

[Calendar](x-fantastical3://show/calendar/<% date("yyyy-MM-dd", today) %>)

If this works it will be wondeful!

1 Like