Runtime verified Differs from official docs Test scripts included

Moves a date forward or back by a number of time units.

Syntax

{{dateAdd date number interval}}

Returns string.

Parameters

Name Type Required Description
date string Yes The starting date.
number integer Yes How many units to add. A negative number moves the date back.
interval string Yes Time unit: Y, M, D, H, MI, or S.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{dateAdd "2024-02-29" 1 "Y"}} renders 2025-02-28T00:00:00. The documented result is 2025-02-28 00:00:00.
  • {{dateAdd "2025-01-31" 1 "D"}} renders 2025-02-01T00:00:00. The documented result is 2025-02-01 00:00:00.
Show Next test script
<!-- Marketing Cloud Next test script for the dateAdd helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[2025-02-28T00:00:00] got=[{{dateAdd "2024-02-29" 1 "Y"}}]</p>
<p>c2 expect=[2025-02-01T00:00:00] got=[{{dateAdd "2025-01-31" 1 "D"}}]</p>

Differs from official docs

  • The reference states the result is a date-time string shaped yyyy-MM-dd HH:mm:ss, with a space between date and time, and shows 2025-02-28 00:00:00 for its leap-year example. In Marketing Cloud Next (tested 2026-11-22): The date math was right, but the separator is a T: {{dateAdd "2024-02-29" 1 "Y"}} rendered 2025-02-28T00:00:00 and {{dateAdd "2025-01-31" 1 "D"}} rendered 2025-02-01T00:00:00. Code that compares or splits the result on the space breaks. Details

Marketing Cloud Next

See also