GoshPosh / grafana-meta-queries

Grafana plugin for calculating time period metrics like week over week, month over month and year over year etc.
Apache License 2.0
283 stars 71 forks source link

Question: Substracting Dates #99

Closed NightDragon1 closed 4 years ago

NightDragon1 commented 4 years ago

Hi,

Is there a way to substract a date from a date field? e.g. -1d or so?

Thx, BR,

Rob

Gauravshah commented 4 years ago

you should be able to write javascript within arithmetic

new Date(A['some_col']).setDate(( new Date(A['some_col']))-5);

NightDragon1 commented 4 years ago

Hi!

Thanks for your answer. I solved it by adjusting the database and adding a view with date -1d.

BR, Rob