different ways to skin the cat.
I use this SQLServer technique;
, dateadd(hour, datediff(hour, getutcdate(), getdate()), ah_timestamp2) as start_time
, dateadd(hour, datediff(hour, getutcdate(), getdate()), ah_timestamp4) as End_time
EDIT:
The solution I originally posted ignores DST time shifts!
The "AT TIME ZONE" solution takes that into account.
, convert(datetime, ah_timestamp2 AT TIME ZONE 'UTC' AT TIME ZONE 'Pacific Standard Time') as Start_Time
, convert(datetime, ah_timestamp4 AT TIME ZONE 'UTC' AT TIME ZONE 'Pacific Standard Time') as End_Time
------------------------------
Pete Wirfs
SAIF Corporation
Salem Oregon USA
------------------------------
Original Message:
Sent: 08-12-2020 12:38 PM
From: Mylene Chalut
Subject: TimeStamps in database do not match the real execution time
Thank you @Leonard Olteanu !!
------------------------------
Programmer-analyst
Statistics Canada
Original Message:
Sent: 08-12-2020 10:24 AM
From: Leonard Olteanu
Subject: TimeStamps in database do not match the real execution time
Hi Mylene,
If you are on SQL Server 2016 or later, you can convert dates to UTC like this:
select CONVERT(datetime, @stDate AT TIME ZONE 'Eastern Standard Time' AT TIME ZONE 'UTC')
------------------------------
Cheers,
Leonard
Original Message:
Sent: 08-12-2020 10:03 AM
From: Mylene Chalut
Subject: TimeStamps in database do not match the real execution time
Thank you for the fast reply !! However, I don't think I can use that function in my sql statement nor when I created my Vara to Chart Analytics report... am I right ?
Declare @stDate datetime
Declare @hours int = Cast(? as int)
-- Get current date
Declare @theDate datetime = GETDATE();
-- Set Start Date 24hr prior
SET @stDate = dateadd(hour,-@hours,@theDate)
select ah_Name
, ah_Idnr
, ah_Otype
, ah_Stype
, ah_status
, ah_timestamp2 as StartTime
, ah_timestamp4 as EndTime
, ah_RunTime
from ah
where ah_client = ?
and ah_otype in ('JOBS','JOBP','EVNT','JSCH')
and ah_timestamp2 >= @stDate
and ah_timestamp4 <= @theDate
order by ah_timestamp2 desc
------------------------------
Programmer-analyst
Statistics Canada
Original Message:
Sent: 08-12-2020 09:24 AM
From: Wolfgang Brueckler
Subject: TimeStamps in database do not match the real execution time
Hi
Timestams in DB are stored in UTC.
You can ues script function CONV_TIMESTAMP to convert it.
cheers, Wolfgang
------------------------------
Support Info:
if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
Otherwise update/upgrade your system and check if the problem still exists.
Original Message:
Sent: 08-12-2020 09:14 AM
From: Mylene Chalut
Subject: TimeStamps in database do not match the real execution time
Hello !
I created a VARA.SQLI to query the database and was very suprised to see the the TimeStamp2 (Start Date) and TimeStamp4 (End Date) do not match with what I have in the Process Monitoring screen. Any idea why, and how can this be fixe ?
Process Monitoring:
VARA:
Thank you :-)
------------------------------
Programmer-analyst
Statistics Canada
------------------------------