Hello,
Small trick avoiding annoying situation. You have 1 Trend (or Logs) table in SQL Server. TS column is recorded but, as you know already, TS is given in GMT0 time. So, analyzing records you have always to convert to local time. Annoying...
Here is a basic SQL request that will return the TS in local time.
SELECT DATEADD(hour, 8, [TS]) as 'Local Timestamp', [Name], [Value], [Quality] FROM [MY_DATABASE].[dbo].[MY_TRENDTABLE]
8 is for GMT+8 time.
Of course, the best is still to use the dll we provide to convert the Chrono. But, often on site you dont have the possibility adding this dll on SQL Server...
Nico
And unfortunately this answer does not take into account DST, thus it is wotking only right now but not always for past records.
There is currently no method in T-SQL that makes the exact convertion from UTC to Local time.
In addition to the dll (which is able to make the exact convertion for any record), another method you can apply is to store in an extended attribute the time shift and then make your convertion based on it. And I'll not talk about the possibility to use a trigger to update the records as it is not recommended 😉
Yep.
Should be a good idea adding the Timeshift property in a table optional column isnt?
Florent you had the idea you make the improvement SPR 😉
Nico


