Use template variable to define time range

I have a $date template variable an I would like to integrate it with the time range so that my graph displays the relevant time segment upon variable selection.