Overview
This API endpoint helps you round given time to the nearest specified interval. You can choose to round the time either up or down, and even provide a custom rounding interval.
Endpoint Information
- Method: POST
- Endpoint URL: https://node.nodetrigger.com/api/round-time
- Content Type: application/json
Example Requests
To use this endpoint, send a JSON request with the following structure:
{ "date": "15:27", "format": "HH:mm", "round": 5, "direction": "up", "customRound": 3 }
This request would round the time 15:27 up to the nearest 5 minutes, also demonstrating a custom rounding of 3 minutes.
Notes
- Make sure to include all required parameters: date, format, round, and direction.
- The format parameter should represent how the date/time is formatted. For example, “HH:mm” for hours and minutes.
- If you want to implement custom rounding, provide a customRound value. Positive numbers will round up, while negative numbers will round down.
- You will get a rounded time, both 5 and 10 minutes up and down, and any custom rounding as specified.
- Responses will include the original date, the formatted date (DD/MM/YYYY), and the rounded times at your specified intervals.
“`