Using $__Timefilter() with only MM-DD-YYYY

Grafana 9.5.1

I am having issues with some of my dashboards that use $__timefilter(). Instead of choosing 7 days ago, its choosing 7 days ago per second, so as it gets closer to 5pm, I lose reported data all day long.

I cannot build multiple dashboards per each time selection (last 7 days, last 30 days, last 5 years, etc). So I must use a dynamic solution based on the top right date selection.

Is there a way to transform the timefilter data? $__timefilter(date_format(created, %d-%m-%y)) ?


what is the data source you are filtering using $timefilter?

It is a Maria DB. I am doing the following conversion on an aliased field.

Column alone:

After my conversion:

All that to say, the (created) column I am pulling is in the database as YYYY_MM_DD_HH_MM_SS_MS. I cannot use an alias as the target of $_timefilter(alias), it will only accept a real column name.

I did not see on the documentation any transforms that it supports like (convert(created)).

What data type does this function return in mariadb? basically what timefilter does is create a created_date between somedate and anotherdate
You can see this when you click Query Inspector, query tab

So instead of using that function do it statically as you would in a mariadb query tool

declare @from date
declare @to date

set @from = date_format($timeFrom())
set @to = date_format($timeTo())

your query

where createddate between @from and @to

type of thing. so leverage the actual query language of mariadb instead of relying on the $timefilter