Skip to content
Browse all functions

Add Value to a Date

datetime/addtodate

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.

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

Try it in the 1001fx app

Run addtodate in your browser with your API key – fill the form, click Run and get the answer or the file.

addtodate in the 1001fx app: the form with example values
Add Value to a Date in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/datetime/addtodate
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json

Parameters

  • datestring (DD.MM.YYYY)required

    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.

    Example:
    14.08.2020
  • keyenumrequired

    What to add.

    Values:
    days
    years
    quarters
    months
    weeks
    hours
    minutes
    seconds
    milliseconds
    Example:
    days
  • amountnumberrequired

    The amount of days, months, etc. to add. Provide a negative amount to subtract.

    Example:
    5

Examples

Add 5 days

Adds 5 days to the given date

Input

Expects a json body
{
  "date": "14.08.2020",
  "key": "days",
  "amount": 5
}

Output · HTTP 200

Response
{
  "result": "19.08.2020"
}
Show curl command
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}'

Add 1 day (Leap year)

Adds 1 day in a leap year to the given date

Input

Expects a json body
{
  "date": "02-28-2024",
  "key": "days",
  "amount": "1"
}

Output · HTTP 200

Response
{
  "result": "02-29-2024"
}
Show curl command
curl -X POST 'https://api.1001fx.com/datetime/addtodate' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"date":"02-28-2024","key":"days","amount":"1"}'

Frequently asked questions

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.

Use cases

Try addtodate now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.002.03.2023created
Ask 1001fx