Stream Analytics: Need to ignore the offset mentioned in time RRS feed

All replies

  • Hello,

    All time handling operations in Azure Stream Analytics are in UTC. It is recommended that timestamps are in UTC time zone and in ISO 8601 format. Time zone conversion is only possible through JavaScript user define functions.

    Reference: JavaScript user-defined functions in Azure Stream Analytics

    Hope this helps. Do let us know if you any further queries.


    Do click on "Mark as Answer" and Upvote on the post that helps you, this can be beneficial to other community members.

    Tuesday, May 5, 2020 1:09 PM
  • Hi Pradeep,

    Thanks for the response.

    The Problem ,I am facing is when attribute with (Datetime with timezone offset) reach SA,it directly  converts into UTC So i loose the offset(timezone) information

    Do you have link for any example for Javascript user define function for TimeZone convertion?

    Tuesday, May 5, 2020 11:27 PM
  • Hello,

    Here is an example of a JavaScript UDF that converts hexadecimal values to integer being invoked in a Stream Analytics query.

    UDF.hex2Int(offset) AS IntOffset

    If you have datetime field you can use TODATETIMEOFFSET function to convert to preferred time zone.

    Hope this helps.

    Thursday, May 7, 2020 11:13 AM
  • Hello,

    Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same. And, if you have any further query do let us know.

    Friday, May 8, 2020 12:13 PM
  • Hi Pradeep,

    Thanks for the response.

    First I have 1 attribute where I have datetime converted into TimeZone value

    "startDateTimeLocal": "2020-05-05T11:40:00-06:00"

    I have no attribute which mention offset alone

    Now in SA the moment i get from Event Hub it get converted into UTC

    "startDateTimeLocal": "2020-05-05T17:40:00.00000"

    So i no longer have this Offset value/attribute which is used in Java script object.

    The second point TODATETIMEOFFSET function can't be used in SA,so i loose the information about timezone.

    As of now how we are doing is from eventhub we are converting attribute with datetime with timezone value into string and then trimming the timezone details.and passing as it is in SA.

    Monday, May 11, 2020 12:33 AM