Only date portion of $timeFilter required


I am using MSSQL as a data source. All is fine.

However, I am trying to use: $_timeFilter for my Time Series of data - but I only need the date portion (as I am not getting all my data set back - due to the time element starting at the current time).



Gives me as a generated SQL:

created BETWEEN ‘2020-03-24T15:33:18Z’ AND ‘2020-03-31T14:33:18Z’

But I want it to say:

created BETWEEN ‘2020-03-24’ AND ‘2020-03-31’

How do I achieve this?

Many Thanks.

I think you could do this using the MSSQL convert function.

Thanks - that would be fine…

However, I need to use it with the $_timeFilter so the Time Series in the output works…
If I just use convert - then my Time Series doesnt seem to work…

You will need to use the $__timeFrom() and $__timeTo() macros instead of $__timefilter and build your own BETWEEN clause.

$__timeFilter() will generate something like BETWEEN ‘2017-04-21T05:01:17Z’ AND ‘2017-04-21T05:06:17Z’ which is not a datetime that you can pass into the convert function.

Thanks - will have a play with that.