This endpoint calculates the difference in days between two provided dates.
Request Method
POST (Recommended to be changed to POST for best practices as it involves data processing)
Query Parameters
- date1 (required, string): The first date in the specified format.
- date2 (required, string): The second date in the specified format.
- format (required, string): The date format. Accepted values are ‘MM/DD/YYYY’ or ‘DD/MM/YYYY’.
Response
- days_difference (integer): The number of days between the two provided dates.
- errors (array): List of validation errors, if any.
- error (string): Error message, if any.
Usage
To use this endpoint, send a GET request to the URL with the required query parameters.
Example 1: Calculate the difference between two dates in MM/DD/YYYY format
Request:
POST https://node.nodetrigger.com/date-difference?date1=12/01/2023&date2=12/10/2023&format=MM/DD/YYYY
Response:
{
"days_difference": 9
}
Example 2: Calculate the difference between two dates in DD/MM/YYYY format
Request:
POST https://node.nodetrigger.com/date-difference?date1=01/12/2023&date2=10/12/2023&format=DD/MM/YYYY
Response:
{
"days_difference": 9
}