# addtodate: Add Value to a Date

> addtodate (Add Value to a Date) is a 1001fx API function in the group Date & time: POST https://api.1001fx.com/datetime/addtodate, 1 credit per call. It works as a ready-made module in n8n or as a plain HTTP call.

Adds a specified number of days, months, etc. to a given date. It can also subtract dates by adding negative values.

- Group: Date & time
- Endpoint: `POST https://api.1001fx.com/datetime/addtodate`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 1 credit per call
- Ready-made in: n8n
- Docs: https://1001fx.com/functions/addtodate

## Parameters

- `date` (string (DD.MM.YYYY), required) – Date: The date to add to. Your date needs to be in one of the following formats DD.MM.YYYY, DD.MM.YY, DD.MM.YYYY HH:mm, DD.MM.YY HH:mm, MM-DD-YYYY, MM-DD-YYYY HH:mm, MM-DD-YY, MM-DD-YY HH:mm.
- `key` (enum, required, one of `days`, `years`, `quarters`, `months`, `weeks`, `hours`, `minutes`, `seconds`, `milliseconds`) – Key: What to add.
- `amount` (number, required) – Amount: The amount of days, months, etc. to add. Provide a negative amount to subtract.

## Use cases

- Set a due date 14 days after the invoice date in an n8n workflow
- Calculate the renewal date of a subscription one year after the start date
- Find the date 30 days ago to filter old records
- Schedule a follow-up email 3 hours after a form submission

## Example: Add 5 days

```bash
curl -X POST 'https://api.1001fx.com/datetime/addtodate' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"date":"14.08.2020","key":"days","amount":5}'
```

Answer (HTTP 200):

```json
{
  "result": "19.08.2020"
}
```

## FAQ

**How do I subtract days from a date?**

Use a negative amount. An amount of -7 with the key days returns the date one week earlier.

**Which units can I add?**

Years, quarters, months, weeks, days, hours, minutes, seconds and milliseconds.

**In which format does the result come back?**

In the format of the input date: 14.08.2020 plus 5 days returns 19.08.2020, 02-28-2024 plus 1 day returns 02-29-2024. Leap years are taken into account.
