Grafana Queries with From and To Timepicker

Hi,
I am using Grafana V1.7 with Influxdb as data source.

  1. I need “from time picker” and “to time picker” separately to make condition based queries.
  2. How to get time difference of selected time range and get it in a variable to use with a query.
    Means

Is there any variable defined in grafana which hold the FROM and TO Time range values …what is the procedure to create a variable to hold the FROM and TO Time range

Please help