Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

Converting UTC times in SWQL results

$
0
0

Hi,

 

I am trying to write an SWQL query that will sum a statistic for a SAM counter by day for the last 7 days.  The query works, but the times returned are UTC so don't translate correctly into local days.  Is there a function in SWQL to convert timezones or add hours to a timestamp?  DATEADD doesn't seem to be available.  On the same subject, is there a list of available SWQL functions anywhere?  I couldn't see on in the SDK docs or find one online.

 

Thanks,

 

Patrick

 

 

SELECT

    decs.Label AS Stat,

    month(cs.TimeStamp)AS Month,

    day(cs.TimeStamp) AS Day,

    SUM(de.AvgNumericData) AS TxPerDay

FROM orion.apm.Component c

INNER JOIN orion.apm.ComponentStatus cs

    ON c.ComponentID = cs.ComponentID

INNER JOIN orion.apm.DynamicEvidenceColumnSchema decs

    ON c.ComponentID = decs.ComponentID AND decs.Type = 1

INNER join orion.apm.DynamicEvidence de

    ON cs.ID = de.ComponentStatusID AND decs.ColumnSchemaID = de.ColumnSchemaID

WHERE decs.Label = 'PV TPM' AND DAYDIFF(cs.TimeStamp, getdate()) < 7

GROUP BY

    decs.Label,

    month(cs.TimeStamp),

    day(cs.TimeStamp)

ORDER BY

    month(cs.TimeStamp) DESC,

    day(cs.TimeStamp) DESC


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>