# Error: Incorrect Format. First Argument in Date Arithmetic Should Be a Date

This error means the first value in your date math is not a valid date.

S-Docs expects the first argument in `<MATH type="date">` to be:

* a date field
* or a static date in `yyyy-MM-dd` format

If the value is missing, text-based, or actually a datetime field, the calculation fails.

### Common causes

This error usually happens when:

* the field is blank
* the field is not a date field
* the field is a datetime field, not a date field
* the math expression starts with plain text instead of a date value

### Example of the problem

This will fail because `SERVICE INSTRUCTIONS` is not a date:

{% code title="invalid-date-math.txt" %}

```
SERVICE INSTRUCTIONS + DAYS(21)
```

{% endcode %}

This can also fail if the merge field looks like a date to a user, but actually stores both date and time.

### Correct pattern

Start the math expression with a real date field.

{% code title="valid-date-math.xml" %}

```xml
<MATH type="date">{{!Opportunity.CloseDate}} + DAYS(21)</MATH>
```

{% endcode %}

You can also format the result on the `<MATH>` tag.

{% code title="formatted-date-math.xml" %}

```xml
<MATH type="date" format-date="M/dd/yyyy">
  {{!Opportunity.CloseDate}} + DAYS(21)
</MATH>
```

{% endcode %}

### How to fix it

Check each date math block in your template source.

Then confirm these items:

* the first value is a real date field
* the field is not blank
* the field is not a datetime field
* the tag includes `type="date"`

If you are using a static date, use this format:

`2026-03-24`

### Quick checklist

Before you test again, confirm:

* your tag starts with `<MATH type="date">`
* the first argument is a date
* static dates use `yyyy-MM-dd`
* you are not using descriptive text in place of a date field

{% hint style="info" %}
If a field includes both date and time, it may still fail in date arithmetic. Use a true date field whenever possible.
{% endhint %}

### Next step

For a beginner walkthrough, see [Get Started with Calculations](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/AWClXpysUyYPXaqZa7po).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/perform-calculations/error-incorrect-format.-first-argument-in-date-arithmetic-should-be-a-date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
