AMPscript DateParse (Next)
Turn a date string into a date value with AMPscript DateParse in Marketing Cloud Next. Syntax, examples, and behaviour proven in a Marketing Cloud Next email, including how it differs from Engagement.
Syntax
DateParse(dateString[, useUtc]) → date
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
dateString |
string | date | Yes | A date or timestamp string, or an existing date value |
useUtc |
string | boolean | number | No | Whether to return the instant in UTC instead of the account time zone; defaults to off. Accepts true, false, 1, 0, "true", "false", "1", "0" |
In Next the second argument is accepted in all eight spellings, and even as an arbitrary word, but it did not change the value in any test.
Example
%%=DateParse("2026-03-04T09:05:07")=%%
Renders 3/4/2026 9:05:07 AM.
The result is a date, so it can go straight into a formatting call:
%%=FormatDate(DateParse("2026-03-04T09:05:07"), "yyyy-MM-dd")=%%
Renders 2026-03-04.
Return value
date — printed on its own as a US short date with a 12-hour clock and AM/PM: 3/4/2026 12:00:00 AM for a date without a time. Length() over that value returns 20.
DatePart, FormatDate, DateAdd and DateDiff all accept the result. Note that a DateAdd over it prints in ISO form (2026-03-05T00:00:00), not in the US form.
Behaviour
Common formats parse.
| Call | Renders |
|---|---|
DateParse("2026-03-04") |
3/4/2026 12:00:00 AM |
DateParse("2026-03-04 09:05:07") |
3/4/2026 9:05:07 AM |
DateParse("2026-03-04 9:05:07 AM") |
3/4/2026 9:05:07 AM |
DateParse("2026-03-04T09:05:07") |
3/4/2026 9:05:07 AM |
DateParse("3/4/2026 9:05 AM") |
3/4/2026 9:05:00 AM |
DateParse("4 March 2026") |
3/4/2026 12:00:00 AM |
DateParse("March 4, 2026") |
3/4/2026 12:00:00 AM |
Offsets in the input are applied. 2026-03-04T09:05:07Z gives 9:05:07 AM, +02:00 on the same clock time gives 7:05:07 AM, and -06:00 gives 3:05:07 PM. The RFC form Wed, 04 Mar 2026 09:05:07 GMT gives 9:05:07 AM, like the Z form.
The second argument has no effect. 1, 0, true, false and the quoted forms of all four returned 3/4/2026 9:05:07 AM for 2026-03-04 09:05:07, and a DateDiff in hours between the flag-off and flag-on results is 0. The word spring is accepted as well.
A time without a date parses. Format(DateParse("1:41 PM"), "HH:mm:ss") renders 13:41:00.
A day-first date is read month-first. DateParse("5/8/2026") gives 5/8/2026 12:00:00 AM, the 8th of May, without any warning.
A date value can be passed back in. DateDiff(DateParse(Now()), Now(), "MI") is 0.
Unreadable input is printed back, not rejected. DateParse("not a date at all") renders not a date at all, and the numeric string "1772614800" renders as those digits. The preview does not fail, so check the input before relying on the result.
One or two arguments. An email with DateParse() or with three arguments cannot be saved: the content API answers HTTP 400 with “The AMPscript syntax isn’t valid”.
Show Next test script
<!-- Marketing Cloud Next test script for DateParse. 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=[2026-03-04] got=[%%=Format(DateParse("2026-03-04"),"yyyy-MM-dd")=%%]</p>
<p>c2 expect=[3/4/2026 12:00:00 AM] got=[%%=DateParse("2026-03-04")=%%]</p>
<p>c3 expect=[3/4/2026 9:05:07 AM] got=[%%=DateParse("2026-03-04 09:05:07")=%%]</p>
<p>c4 expect=[3/4/2026 12:00:00 AM] got=[%%=DateParse("March 4, 2026")=%%]</p>
<p>c5 expect=[3/4/2026 9:05:07 AM] got=[%%=DateParse("2026-03-04 9:05:07 AM")=%%]</p>
<p>c6 expect=[3/4/2026 9:05:07 AM] got=[%%=DateParse("2026-03-04T09:05:07")=%%]</p>
<p>c7 expect=[3/4/2026 9:05:00 AM] got=[%%=DateParse("3/4/2026 9:05 AM")=%%]</p>
<p>c8 expect=[3/4/2026 12:00:00 AM] got=[%%=DateParse("4 March 2026")=%%]</p>
<p>c9 expect=[3/4/2026 9:05:07 AM] got=[%%=DateParse("Wed, 04 Mar 2026 09:05:07 GMT")=%%]</p>
<p>c10 expect=[13:41:00] got=[%%=Format(DateParse("1:41 PM"),"HH:mm:ss")=%%]</p>
<p>c11 expect=[3/4/2026 7:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 3:05:07 PM] got=[%%=DateParse("2026-03-04T09:05:07+02:00")=%%|%%=DateParse("2026-03-04T09:05:07Z")=%%|%%=DateParse("2026-03-04T09:05:07-06:00")=%%]</p>
<p>c12 expect=[5/8/2026 12:00:00 AM] got=[%%=DateParse("5/8/2026")=%%]</p>
<p>c13 expect=[3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM|3/4/2026 9:05:07 AM] got=[%%=DateParse("2026-03-04 09:05:07",0)=%%|%%=DateParse("2026-03-04 09:05:07",1)=%%|%%=DateParse("2026-03-04 09:05:07",true)=%%|%%=DateParse("2026-03-04 09:05:07",false)=%%|%%=DateParse("2026-03-04 09:05:07","1")=%%|%%=DateParse("2026-03-04 09:05:07","0")=%%|%%=DateParse("2026-03-04 09:05:07","true")=%%|%%=DateParse("2026-03-04 09:05:07","false")=%%]</p>
<p>c14 expect=[0] got=[%%=DateDiff(DateParse("2026-03-04 09:05:07",0),DateParse("2026-03-04 09:05:07",1),"H")=%%]</p>
<p>c15 expect=[3/4/2026 9:05:07 AM] got=[%%=DateParse("2026-03-04 09:05:07","spring")=%%]</p>
<p>c16 expect=[2026|5|2026-03-04|2026-03-05T00:00:00|2] got=[%%=DatePart(DateParse("2026-03-04T09:05:07"),"Y")=%%|%%=DatePart(DateParse("2026-03-04T09:05:07"),"MI")=%%|%%=FormatDate(DateParse("2026-03-04T09:05:07"),"yyyy-MM-dd")=%%|%%=DateAdd(DateParse("2026-03-04"),1,"D")=%%|%%=DateDiff(DateParse("2026-03-04"),DateParse("2026-03-06"),"D")=%%]</p>
<p>c17 expect=[0|0] got=[%%=DateDiff(DateParse(Now()),Now(),"MI")=%%|%%=DateDiff(Now(),DateParse(Now(),1),"H")=%%]</p>
<p>c18 expect=[20] got=[%%=Length(DateParse("2026-03-04"))=%%]</p>
<p>c19 expect=[1772614800] got=[%%=DateParse("1772614800")=%%]</p>
<p>c20 expect=[not a date at all] got=[%%=DateParse("not a date at all")=%%]</p>
Show calls that fail in Next (one email each)
<!-- Run each call below in its own Next email: one of them in a combined email
would stop the whole preview or block the save. -->
<!-- email 1: expect that the save is rejected (HTTP 400) -->
%%=DateParse()=%%
<!-- email 2: expect that the save is rejected (HTTP 400) -->
%%=DateParse("2026-03-04 09:05:07",1,"extra")=%%
Differs from official docs
- Unreadable text is passed through. The reference does not say what happens to text that is not a date. In Next,
DateParse("not a date at all")returned that text unchanged, without failing. Card
Availability & differences
| Platform | Available |
|---|---|
| Marketing Cloud Engagement | Yes |
| Marketing Cloud Next | Yes, from API 67.0 |
In Engagement the second argument switches to UTC (DateParse("2026-03-04 09:05:07",1) gives 3/4/2026 3:05:07 PM); in Next every spelling of it returns 3/4/2026 9:05:07 AM. Offset, Zulu and GMT timestamps land six hours apart: 2026-03-04T09:05:07Z gives 3:05:07 AM in Engagement and 9:05:07 AM in Next. An unreadable string aborts the Engagement page, while Next prints it back unchanged. Compared 2026-11-23 by rendering the same calls in a Marketing Cloud Next email.
See also
- StringToDate — the same parsing without the second argument
- FormatDate — the usual next call
- DateAdd
- DateDiff
- DatePart
- Official reference