Comparing string date fields in Influxql

Grafana: 10.0.2
InfluxDB: 1.8.10-1
OS: Ubuntu

I hope this is the correct place to ask. Apologies if not.

I am trying to query data from InfluxDB in Grafana ‘Explore’ in influxql.

I would like to compare a string field ‘AvailableDate’ against the time stamp of the data itself (time). This field is in MM/DD/YYYY format.

SELECT … WHERE time >= AvailableDate

Is there any way that I can cast this string to a timestamp format for comparison?

why is that column a string? wouldnt it be better that its data type is datetime in the first place?

Ideally yes but that’s unfortunately not something I can change. I have over a year of historical data and this is a field I now need to generate a report with.

1 Like

@x3la

Just in case you can change from InfluxQL to Flux, this should be possible using the time() function in Flux.

I don’t think that will work as the date isn’t in RFC3339 format, it’s mm/dd/yyyy.

I think I’ll just dump the data and import it into something else.