Template variable - convert to seconds


I have created a template variable of ‘interval’ type. It has options like 7 days, 1 month etc.

Based on the selection, I want to group the data I have. If I access my template variable, it displays 7d or 1d based on selection. How do I convert it to seconds/milliseconds so that I can query accordingly?



Are you able to do this, I am also looking solution to same problem. Let me know here if you have successfully achieved this conversion.