Can I display database timestamps as Local Time rather than UTC?
Issue
The timestamps in the ION_Data database are stored in Universal Coordinated Time (UTC). A user would like to show these timestamps as Local Time.
Product Line
PME 8.x, 9.0, 2020, 2021, 2022, 2023
Power Monitoring Expert 7.2.x
StuxureWare Power Monitoring 7.0.x
Environment
SQL Server Management Studio
Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by
users familiar with SQL Server Management Studio. Databases should be backed up before
performing this procedure.*
This article describes a simple workaround to display the timestamp in local time instead of UTC. The DATEADD() function adds or subtracts a specified time interval from a date when executing a SQL query.
The following SQL query utilizes the DATEADD function to convert from UTC to Pacific time ( UTC -8) and creates a new temporary column ' local time that displays the corresponding result:
SELECT TOP 1000 [ID]
,[Value]
,[SourceID]
,[QuantityID]
,DATEADD (HH,-8,TimestampUTC) as LocalTime
FROM [ION_Data].[dbo].[DataLog2] order by LocalTime desc
The '-8' corresponds to Pacific Time (UTC -8) and will need to be changed to convert to other time zones. The figures below show Executed query results as well as the original query :
Another example :

The timestamps in the ION_Data database are stored in Universal Coordinated Time (UTC). A user would like to show these timestamps as Local Time.
Product Line
PME 8.x, 9.0, 2020, 2021, 2022, 2023
Power Monitoring Expert 7.2.x
StuxureWare Power Monitoring 7.0.x
Environment
SQL Server Management Studio
Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by
users familiar with SQL Server Management Studio. Databases should be backed up before
performing this procedure.*
This article describes a simple workaround to display the timestamp in local time instead of UTC. The DATEADD() function adds or subtracts a specified time interval from a date when executing a SQL query.
The following SQL query utilizes the DATEADD function to convert from UTC to Pacific time ( UTC -8) and creates a new temporary column ' local time that displays the corresponding result:
SELECT TOP 1000 [ID]
,[Value]
,[SourceID]
,[QuantityID]
,DATEADD (HH,-8,TimestampUTC) as LocalTime
FROM [ION_Data].[dbo].[DataLog2] order by LocalTime desc
The '-8' corresponds to Pacific Time (UTC -8) and will need to be changed to convert to other time zones. The figures below show Executed query results as well as the original query :
Another example :
게시 대상: 슈나이더 일렉트릭 Korea


도움이 필요하신가요?
제품 선택기
애플리케이션에 적합한 제품과 액세서리를 빠르고 쉽게 찾을 수 있습니다.
견적 받기
영업 관련하여 온라인으로 문의하시면 전문가가 연락드립니다.
구매처
해당 지역의 가장 가까운 슈나이더 일렉트릭 대리점을 쉽게 찾을 수 있습니다.
지원 센터
한 곳에서 모든 요구 사항에 대한 지원 리소스를 찾아보십시오.