Storing current date into a variable

I am trying to achieve something fairly simple, and despite spending the last couple of hours browsing this forum I have not found my answer. Maybe I can’t search properly.

Anyway, there you go:

I’m building a dashboard plugged on an API (there is no db connection) and I need to send the current date (and eventually also current_date - n_days) as a parameter to the API.

It is my understanding that I have to create a variable first. This is where I’m currently struggling, I’m selecting “Grafana” as datasource in the variable creation form and then, I have no idea what kind of query so set in order to get my current date.
I tried several queries such as “SELECT DATE()”, “CURDATE()” etc… but nothing seems to work.

Any hint would be much appreciated!

This can be done by getting the date and time by performing an API request using the Infinity plugin in Grafana.

You first need to install the Infinity plugin and make it as an Data source. Then in the variable page choice it as the Query option. Then use the WorldTimeAPI API for example to request the local Time and Date for a specific location.

I hope this answers your question.