Rule: Add Days to Date#

This rule writes a date into the selected element that equals today’s date plus the number of days you specify. This way, you can always have, for example, an up-to-date expected delivery date. The rule is most commonly used for Google formats, specifically for product availability when the availability element contains the value preorder or backorder. In these cases, you also need to provide a specific availability date.

Extra features#

  • The rule can rewrite values for multiple queries
  • Output value preview - for verification purposes
  • The resulting element value after applying the rule is a date: 2025-10-16T16:13:19
  • Available formats:
    • YYYY-MM-DD - Year-Month-Day (ISO 8601 standard)
    • YYYY-MM-DDTHH:MM:SS - Date and time with “T” separator (e.g., 2025-06-24T12:46:12)
    • YYYY/MM/DD - Year/Month/Day with slashes
    • DD/MM/YYYY - Day/Month/Year (European format)
    • MM/DD/YYYY - Month/Day/Year (American format)
    • YYYYMMDD - Compact format without separators
    • DD.MM.YYYY - Day.Month.Year
    • Unix timestamp - Number of seconds since January 1, 1970 (for systems and APIs)

Practical examples#

Example 1: Setting expiration_date and availability_date elements for Google feeds#

This example shows how to easily set the expiration date (expiration_date) and availability date (availability_date) when a product has the value preorder or backorder in the feed. In these cases, you must provide a specific date, otherwise the Google feed will be incomplete.

1. Creating a new rule:

  • Open the “Rules” page.
  • Click the New rule button.

2. Selecting the rule type:

  • In the Rule type field, select the Add Days to Date option.

3. Choosing the element to change:

  • In the Element field, select the element where the resulting date should be written.
  • In our case, this could be [expiration_date] or [availability_date]

4. Choose the date format:

  • From the list, select the following format suitable for Google: YYYY-MM-DDTHH:MM:SS

5. Selecting products:

  • In the Query field, choose either All products or create your own Product query if you want to apply the rule only to certain products (e.g., g:availability = preorder)

6. Enter the number of days to add:

  • In the “How many days to add” field, enter the number of days you want to add to today’s date.
  • For example: 5 means the resulting date will be today + 5 days.

7. Check the result:

  • The “Output value preview” column shows the resulting value that will be written to the output feed.
  • For example: 2025-10-21T16:13:19.

8. Naming the rule:

  • In the last step, enter the rule name, for example “Set availability date for preorder products”.

FAQ#

What is the Add Days to Date rule for?#

The rule automatically writes into the selected element a current date shifted by the specified number of days. It is most commonly used to set values like availability_date or expiration_date in Google feeds – typically for products with the value preorder or backorder.

In what situations is this rule most commonly needed?#

It is primarily used for:

  • filling in required dates in Google feeds,
  • ensuring the availability date is always current,
  • automatically extending dates (e.g., expiration_date + 30 days).

What date format should I use for Google Merchant feeds?#

The recommended format for Google is: YYYY-MM-DDTHH:MM:SS Example: 2025-06-24T12:46:12 This format includes both date and time and complies with the ISO 8601 standard required by Google.

Can I choose a different date format?#

Yes. Mergado supports various formats, for example:

  • YYYY-MM-DD (e.g., 2025-10-16)
  • DD.MM.YYYY (e.g., 16.10.2025)
  • YYYY/MM/DD
  • YYYYMMDD
  • or Unix timestamp (e.g., 1739625600)

💡 This is useful for exports to systems that use their own date formats.

What does the “How many days to add” field mean?#

In this field, enter the number of days by which today’s date should be shifted. E.g.:

  • Value +5 → today’s date + 5 days
  • Value 0 → today’s date

The result is immediately shown in the Output value preview column.

Can the rule be used for multiple queries at once?#

Yes. The rule supports application to multiple product queries simultaneously, so you can set different time shifts for different product groups (e.g., preorder +5 days, backorder +14 days).

Can I use this rule to overwrite an existing date in an element?#

Yes. If the element (e.g., availability_date) already contains a value, the rule will replace it with the newly calculated date.

Can adding days be combined with other rules, such as Calculation or Rewrite?#

Yes. It is typically used in combination with the Rewrite rule if you need to fill in empty elements first, or with the Calculation rule if you want to adjust the value dynamically based on another element. 💡 Recommended order: first fill in / adjust the data, then apply “Add Days to Date”.

How do I check if the date was actually written to the feed correctly?#

After saving and applying the rules or after regenerating the feed:

  • view the output feed and check the availability_date or expiration_date element,
  • or run the “Rule walkthrough” feature for a specific product – you will see both the original and new date values.

Can I use a time component (hours, minutes, seconds)?#

Yes. In the YYYY-MM-DDTHH:MM:SS format, you can also set a specific time. For example, 2025-10-21T08:00:00 ensures the product is marked as available starting exactly at 8:00 AM.

What happens if I enter a negative value (e.g., -2)?#

An error message will appear. The rule cannot work with negative numbers in the days field. You can only enter positive numbers (0, 1, 2, …).

What are the most common mistakes when using this rule?#

  • Incorrect date format (e.g., missing time component for Google feeds).
  • Writing to the wrong element (availability instead of availability_date).
  • Entering too high a number (e.g., +999), which can result in a date outside a realistic range.

💡 It is recommended to test the rule on a smaller sample of products.

Can I add days based on values from another element (e.g., based on stock availability)?#

No.

Is it possible to use this rule outside of Google feeds?#

Yes. Although it is most commonly used for Google Merchant feeds, you can use it in any format that works with dates – for example, for exports to ERP systems or custom XML structures.

🇨🇿 🇬🇧 🇩🇪 🇭🇺