MSSQL datetime to Utc and viceversa

Hello,

what can I to to have the macro for converting datetime fields to UTC and viceversa in Microsoft SQL Server queries available in Grafana ?

Something like $__toUtc(field) and $__fromUtc(field)

Has anyone already created these macros ?

thanks a lot
Andrea

without these 2 macros every query becomes unreadable

Welcome @andreabigitechnolog

What version of ms sql server are you on?

select @@VERSION

different versions, but the most important are

version 2019 and 2022

Microsoft SQL Server 2019 (RTM-CU18) (KB5017593) - 15.0.4261.1 (X64)
Sep 12 2022 15:07:06
Copyright (C) 2019 Microsoft Corporation
Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64)
Oct 8 2022 05:58:25
Copyright (C) 2022 Microsoft Corporation
Express Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

bye