Using variables to build start and stop parameters for range()

Hello there,

I like to use Grafana variables to build the start and stop parameters for the range() function.

For that I have a custom date and shift input field.

Here is an examples:

date : 2021-08-25
shift: 1

this should result in range(start: 2021-08-25T06:00:00Z, stop: 2021-0825T14:00:00)

So, I know I have to “if-else-if” throug the shift to get the different times. But in generell my question is how can I build these time formate out of string. Or is it better to use timestamps?

@Ogoku You could use time() function, here is an example convert-a-string-to-a-time-value