Layer7 API Management

  • 1.  Time conversion and compare

    Posted Jun 12, 2018 10:03 AM

    Hi All,

     

    I need a help to convert input date/time and compare with current date/time.

     

    In one variable we are storing date/time value  like "Thu Apr 18 13:51:32 CEST 2019" and this value will change for each request but the format is same. as per the requirement we need to compare the variable time with current gateway time and if the current gateway time is less than or equal to 30days from variable date/time then it should stop..else its should pass.

     

    please help me to develop service for above requirement.( policy xml or assertion screenshots will help lot )

     

    Thank you

    Sudha. 



  • 2.  Re: Time conversion and compare

    Broadcom Employee
    Posted Jun 12, 2018 10:37 AM

    Hi Sudhakar,

     

    I would take a look at this posting here for adding custom date/time formats.

     

    Date Time Conversion 

     

    Once you set that up you can use the .millis suffix to get the epoch time and compare against the current gateway time.

     

    Date and Time Variables - CA API Gateway - 9.1 - CA Technologies Documentation 

     

    Regards,

    Joe



  • 3.  Re: Time conversion and compare

    Broadcom Employee
    Posted Jun 21, 2018 12:17 PM

    Another post that may assist with what you are trying to do: context variable: string to date/time conversion and back 

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 4.  Re: Time conversion and compare

    Broadcom Employee
    Posted Jul 06, 2018 02:47 AM

    You can use set context variable assertion only, I wrote a KB article, but it may not be public available yet. (may need to wait few days)

    https://comm.support.ca.com/kb/date-conversion-apim/KB000105208 



  • 5.  Re: Time conversion and compare

    Broadcom Employee
    Posted Jul 08, 2018 06:56 PM

    KB article is available now, with sample policy and screenshots.

    Date time conversion in APIM - CA Knowledge