I want to limit the output of the time field to YYYY-MM-DD hh:mm:ss
how about Transformations using SQL where we need it.
``
SELECT DATE_FORMAT(timestamp, ‘%Y-%m-%d %H:%i:%s’) AS ts, value
FROM metrics
``
Can you please help me? I don’t know how to incorporate this into the query. If I use it as is, no data is displayed.
My query:
from(bucket: “iobroker_all”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “Weather”)
|> filter(fn: (r) => r[“_field”] == “value”)
Can you leverage transformation and format the dat time to what you desire
Did you try what was recommended? Transformation and of date time field formatting?
the final result according to Gemini’s suggestion:
tested in InfluxDB v2.7.12
import "date"
from(bucket: "iobroker_all")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Wetter")
|> filter(fn: (r) => r["_field"] == "value")
|> map(fn: (r) => ({r with formatted_time: date.formatTime(t: r._time, format: "%Y-%m-%d %H:%M:%S")}))
error @6:46-6:50: record is missing label formatTime
I have now posted the problem in the influx forum
Solved:
In Visualizations, select “Table” instead of “Logs.” Then Transformation->Format time will work.







