IanH
April 5, 2023, 6:50am
1
In Fluxdb 2.6.1 this query returns data in local time
import “timezone”
option location = timezone.location(name: “Europe/London”)
from(bucket: “AshTree_AAGSolo_2days”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “aagsolodata”)
|> filter(fn: (r) => r[“Category”] == “Ambient temp”)
|> drop(columns: [“_start”, “_stop”, “_field”, “_measurement”])
but in nodered this query returns data in UTC
‘import “timezone”\n’ +
‘option location = timezone.location(name: “Europe/London”)\n’ +
‘from(bucket: “AshTree_AAGSolo_2days”)’ +
'|> range(start: ’ + stimestart + ', stop: ’ + stimenow + ‘)’ +
‘|> filter(fn: (r) => r[“_measurement”] == “aagsolodata”)’ +
‘|> filter(fn: (r) => r[“Category”] == "’ + category + ‘“) ’ +
'|> drop(columns: [”_start", “_stop”, “_field”, “_measurement”])’
I need the data in local time. How do I get the data in local time, please ?
IanH
April 12, 2023, 8:08am
2
I am really stuck on this. To ask the question in another way. Is it possible to call
import “timezone”
option location = timezone.location(name: “Europe/London”)
outside of Flubdb ?
IanH
April 12, 2023, 8:27am
3
I have also tried
‘import "timezone"option location = timezone.location(name: “Europe/London”)from(bucket: “AshTree_AAGSolo_2days”)’ +
'|> range(start: ’ + stimestart + ', stop: ’ + stimenow + ‘)’ +
‘|> filter(fn: (r) => r[“_measurement”] == “aagsolodata”)’ +
‘|> filter(fn: (r) => r[“Category”] == "’ + category + ‘“) ’ +
'|> drop(columns: [”_start", “_stop”, “_field”, “_measurement”])’
This also returns UTC data
grant1
April 13, 2023, 9:58am
4
Hi @IanH
This is just an idea that may not even work, but if running the Flux query from NodeRED does indeed not retrieve the data in the desired timezone, then maybe send the UTC data (retrieved via NodeRED) and send through a function node that will adjust the timestamp values.
IanH
April 13, 2023, 4:41pm
5
Thank you. That may be my only option if I can’t get “import” and “option” to work.