Layer7 API Management

 View Only
  • 1.  Date Time Conversion

    Posted Sep 22, 2017 10:15 AM

    Hi Community Team,

     

    How to convert UTC date format in IST Local time with offset to UTC in API gateway service.

    For example source date value is 2017-09-06 19:30:09 now I have to convert into IST local time with UTC offf set i.e. to 2017-09-06 02:00:09+05:30. Here I need to consider day light saving when converting.

     

    Thanks in advance.

     

    Regards,

    Suneel

     



  • 2.  Re: Date Time Conversion

    Posted Sep 22, 2017 10:45 AM

    Hi Suneel,

     

    From where are you getting this date? The reason I ask is that there are a few gateway variables that you can use to get the current date and time. See below

     

    https://docops.ca.com/ca-api-gateway/9-2/en/reference/context-variables/date-and-time-variables

     

    Regards

    Seenu Mathew



  • 3.  Re: Date Time Conversion

    Posted Sep 22, 2017 01:35 PM

    Hi Seenu,

     

    We will get this date value from source request XML and then  I have to convert into IST local time with UTC offf set i.e. to 2017-09-06 02:00:09+05:30 .

     

    Regards,

    Suneel



  • 4.  Re: Date Time Conversion

    Broadcom Employee
    Posted Sep 22, 2017 02:42 PM

    It sounds like you want to get a value from the message and apply rules/conversion to it? 

    Have you reviewed the set context variable? Which then can be referenced wherever you want?

    https://docops.ca.com/ca-api-gateway/9-2/en/policy-assertions/assertion-palette/policy-logic-assertions/set-context-vari… 

     

    It seems if you pull the date out of the request this would be the way to go to convert and apply an offset.

     

    Thanks..



  • 5.  Re: Date Time Conversion

    Posted Sep 22, 2017 03:01 PM

    Hi Charles,

     

    I have gone through the documentation and tried to implement and during the implementation observed that set context variable displayed as unrecognized format when I gave value as '2017-09-06 14:30:09'.

     

    Regards,

    Suneel



  • 6.  Re: Date Time Conversion
    Best Answer

    Broadcom Employee
    Posted Sep 22, 2017 03:17 PM

    I have to assume, 

    2017-09-06 14:30:09'.

    Isnt fitting any of the internal formats I would have to do testing. But I would think it its not recognized you need to update.

     

    https://docops.ca.com/ca-api-gateway/9-1/en/reference/cluster-properties/miscellaneous-cluster-properties 

     

    datetime.customformats (and possibly) auto formats cluster property.

     

    If it helps. I will try to do a quick test with your format but it will likely be next week before that occurs.


    Thanks...



  • 7.  Re: Date Time Conversion

    Posted Sep 26, 2017 02:29 AM

    Hi Charles,

     

    As suggested by you , I have managed to allow input date format by changing the cluster wide property.

    Now am working on other part to convert it to 2017-MM-DDT09:12:00+01:00.

     

    Regards,

    Suneel