ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

API Management: Get the difference between two dates

book

Article ID: 145812

calendar_today

Updated On:

Products

CA API Gateway API SECURITY CA API Gateway Precision API Monitoring Module for API Gateway (Layer 7) CA API Gateway Enterprise Service Manager (Layer 7) STARTER PACK-7 CA Microgateway

Issue/Introduction

We would like to know how can we get the difference(no. of days) between two dates. For example, the input dates will come in query parameters to the Gateway:

&date1=12-11-2019&date2=12-30-2019 

Environment

Release : 9.4

Component : API GATEWAY

Resolution

A sample policy is attached that makes use of the Execute JavaScript Assertion

Additional Information

https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/layer7-api-management/api-gateway/9-4/policy-assertions/assertion-palette/service-availability-assertions/execute-javascript-assertion.html

Attachments

1582637312297__JS-Date-Diff.xml get_app