I am running some tag queries against a postgres TimeScaleDB
My data is coming back with millisecond resolution when I run 1 minute average queries:
"t_stamp","XXXXX",
"2024-05-04 00:02:00.028","0.2266050743890813",
"2024-05-04 04:52:04.088","5.7324847185309595"
There is a slight drift in the seconds of the timestamps and this is causing the data team that uses these CSV exports problems I need to get all the time stamps to just be in the yyyyMMdd HH:mm format .
what are my options to get this done ? I don't see any way to format the timestamp in the query. I am really hoping I dont have to loop through the returned data set and modify each row as these queries usually have 3-4million rows.
Why are your timestamps coming back as strings?
Can you post your query? See Wiki - how to post code on this forum.
If your datatype is really timestamp, it should be coming back as a long. It could be that whatever you're using to view the data is doing some autoformatting for you (for example, if you're displaying it in something that expects a date).
If it really is a long, and you really need a formatted date, postgres can format it in the query by using the to_char(timestamp) function.
Oh cant get the query right now but what I pasted above for the timestamps is after I run The dataset.toCSV() hopefully that answers your question
Is this an option when im using system.tag.queryTagHistory()
Make sure that your start timestamp for your query has no seconds or milliseconds, and that the end timestamp for your query ends with :59.999. The return size should be exactly the number of minutes in that span.
doh, you're right. I blame it on being Friday afternoon of a verrrrry long week.
Thanks this was the answer. this is exactly how I fixed it:
self.view.custom.startTime and self.view.custom.endTime are date/time components
startTime = system.date.parse(self.view.custom.startTime.formattedValue, "yyyy-MM-dd HH:mm")
endTime = system.date.parse(self.view.custom.endTime.formattedValue, "yyyy-MM-dd HH:mm")