Runtime verified Test scripts included

Syntax

SystemDateToLocalDate(systemTime)  →  date
1 argument — exactly

Parameters

Name Type Required Description
systemTime string | date Yes The system time value to convert, as a date value or a parseable date string

Example

%%[
  VAR @local
  SET @local = SystemDateToLocalDate("2026-01-15 09:30:00")
]%%
%%=v(@local)=%%

Renders 1/15/2026 4:30:00 PM on the account this page was proven against — seven hours later than the input.

The result is a real date, so the usual pattern is to format it in the same expression rather than render it raw:

%%[
  VAR @sentAt
  SET @sentAt = FormatDate(SystemDateToLocalDate(Now()), "yyyy-MM-dd HH:mm")
]%%
<p>Local time: %%=v(@sentAt)=%%</p>

Do not derive the offset once and reuse it — its size depends on the season, as covered below.

Return value

date — a real date value, not text. FormatDate, DatePart and DateAdd all accepted the result directly, and Length() over it returned 20.

There is no closed set of sentinel values to test for, and no failure value either. Every rejected input aborts the page with HTTP 422 rather than returning an error token, so a result that exists is always a real date.

Rendered on its own the value prints as a US short date followed by a 12-hour clock with an AM/PM suffix — 1/15/2026 4:30:00 PM.

Behaviour

The shift is not a fixed offset — it changes with the season. The same wall-clock input six months apart moved by different amounts: 2026-01-15 09:30:00 became 1/15/2026 4:30:00 PM, a DateDiff of 420 minutes, while 2026-07-15 09:30:00 became 7/15/2026 5:30:00 PM, 480 minutes. Exactly one hour more in summer. System time is Central Standard with no daylight-saving adjustment, so the side that moves is the account-configured local zone. Full write-up in the differs-from-docs card.

The account setting decides the result, not the viewer. The conversion is driven entirely by the time zone configured on the account, so every visitor to a CloudPage sees the same converted value regardless of where they are.

LocalDateToSystemDate is an exact inverse. Composing the two in either order returned the original instant with a DateDiff of 0, in both winter and summer — SystemDateToLocalDate(LocalDateToSystemDate("2026-01-15 09:30:00")) rendered 1/15/2026 9:30:00 AM, the input unchanged.

A date value can be passed in as well as a string. SystemDateToLocalDate(DateParse("2026-01-15 09:30:00")) produced the identical value as the string form, and SystemDateToLocalDate(Now()) converts the current instant with no string round-trip. Among strings, the space-separated form, the T-separated ISO form and the US slash form all produced the same result.

An unreadable string takes the whole page down. "not a date at all" and an empty string both returned HTTP 422 with nothing rendered — the same failure mode as DateParse, not the empty string that FormatDate returns. There is no value to test for afterwards, so validate before the call.

Show test script
%%[
  VAR @b, @w, @s
  SET @b = RequestParameter("b")
  SET @w = "2026-01-15 09:30:00"
  SET @s = "2026-07-15 09:30:00"

  /* the control - fetch this whenever a branch below renders nothing */
  IF @b == "ctrl" THEN
    OutputLine(Concat("--- ctrl start ---"))
    OutputLine(Concat("CTRLS2L=[", SystemDateToLocalDate(@w), "]"))
    OutputLine(Concat("CTRLL2S=[", LocalDateToSystemDate(@w), "]"))
    OutputLine(Concat("--- ctrl done ---"))
  ENDIF

  /* the shift is seasonal - winter and summer differ by exactly one hour */
  IF @b == "offset" THEN
    OutputLine(Concat("--- offset start ---"))
    OutputLine(Concat("WIN_IN=[", @w, "]"))
    OutputLine(Concat("WIN_S2L=[", SystemDateToLocalDate(@w), "]"))
    OutputLine(Concat("WIN_L2S=[", LocalDateToSystemDate(@w), "]"))
    OutputLine(Concat("WIN_S2L_MIN=[", DateDiff(DateParse(@w), SystemDateToLocalDate(@w), "MI"), "]"))
    OutputLine(Concat("WIN_L2S_MIN=[", DateDiff(DateParse(@w), LocalDateToSystemDate(@w), "MI"), "]"))
    OutputLine(Concat("SUM_IN=[", @s, "]"))
    OutputLine(Concat("SUM_S2L=[", SystemDateToLocalDate(@s), "]"))
    OutputLine(Concat("SUM_L2S=[", LocalDateToSystemDate(@s), "]"))
    OutputLine(Concat("SUM_S2L_MIN=[", DateDiff(DateParse(@s), SystemDateToLocalDate(@s), "MI"), "]"))
    OutputLine(Concat("SUM_L2S_MIN=[", DateDiff(DateParse(@s), LocalDateToSystemDate(@s), "MI"), "]"))
    OutputLine(Concat("--- offset done ---"))
  ENDIF

  /* both compositions return the original instant exactly */
  IF @b == "rt" THEN
    OutputLine(Concat("--- rt start ---"))
    OutputLine(Concat("RT_W_A=[", SystemDateToLocalDate(LocalDateToSystemDate(@w)), "]"))
    OutputLine(Concat("RT_W_B=[", LocalDateToSystemDate(SystemDateToLocalDate(@w)), "]"))
    OutputLine(Concat("RT_S_A=[", SystemDateToLocalDate(LocalDateToSystemDate(@s)), "]"))
    OutputLine(Concat("RT_S_B=[", LocalDateToSystemDate(SystemDateToLocalDate(@s)), "]"))
    OutputLine(Concat("RT_W_A_MIN=[", DateDiff(DateParse(@w), SystemDateToLocalDate(LocalDateToSystemDate(@w)), "MI"), "]"))
    OutputLine(Concat("RT_W_B_MIN=[", DateDiff(DateParse(@w), LocalDateToSystemDate(SystemDateToLocalDate(@w)), "MI"), "]"))
    OutputLine(Concat("RT_S_A_MIN=[", DateDiff(DateParse(@s), SystemDateToLocalDate(LocalDateToSystemDate(@s)), "MI"), "]"))
    OutputLine(Concat("RT_S_B_MIN=[", DateDiff(DateParse(@s), LocalDateToSystemDate(SystemDateToLocalDate(@s)), "MI"), "]"))
    OutputLine(Concat("--- rt done ---"))
  ENDIF

  /* the result is a real date value the other date functions consume */
  IF @b == "chain" THEN
    OutputLine(Concat("--- chain start ---"))
    OutputLine(Concat("S2L_FD=[", FormatDate(SystemDateToLocalDate(@w), "yyyy-MM-dd"), "]"))
    OutputLine(Concat("L2S_FD=[", FormatDate(LocalDateToSystemDate(@w), "yyyy-MM-dd"), "]"))
    OutputLine(Concat("S2L_PH=[", DatePart(SystemDateToLocalDate(@w), "H"), "]"))
    OutputLine(Concat("L2S_PH=[", DatePart(LocalDateToSystemDate(@w), "H"), "]"))
    OutputLine(Concat("S2L_PY=[", DatePart(SystemDateToLocalDate(@w), "Y"), "]"))
    OutputLine(Concat("S2L_ADD=[", DateAdd(SystemDateToLocalDate(@w), 1, "D"), "]"))
    OutputLine(Concat("S2L_LEN=[", Length(SystemDateToLocalDate(@w)), "]"))
    OutputLine(Concat("L2S_LEN=[", Length(LocalDateToSystemDate(@w)), "]"))
    OutputLine(Concat("--- chain done ---"))
  ENDIF

  /* a date value is accepted as well as a string */
  IF @b == "dateval" THEN
    OutputLine(Concat("--- dateval start ---"))
    OutputLine(Concat("S2L_PARSED=[", SystemDateToLocalDate(DateParse(@w)), "]"))
    OutputLine(Concat("L2S_PARSED=[", LocalDateToSystemDate(DateParse(@w)), "]"))
    OutputLine(Concat("S2L_NOW=[", SystemDateToLocalDate(Now()), "]"))
    OutputLine(Concat("L2S_NOW=[", LocalDateToSystemDate(Now()), "]"))
    OutputLine(Concat("NOWRAW=[", Now(), "]"))
    OutputLine(Concat("--- dateval done ---"))
  ENDIF

  /* several string notations, plus the date-only day-shift trap */
  IF @b == "fmt" THEN
    OutputLine(Concat("--- fmt start ---"))
    OutputLine(Concat("S2L_DATEONLY=[", SystemDateToLocalDate("2026-01-15"), "]"))
    OutputLine(Concat("L2S_DATEONLY=[", LocalDateToSystemDate("2026-01-15"), "]"))
    OutputLine(Concat("S2L_US=[", SystemDateToLocalDate("1/15/2026 9:30 AM"), "]"))
    OutputLine(Concat("L2S_US=[", LocalDateToSystemDate("1/15/2026 9:30 AM"), "]"))
    OutputLine(Concat("S2L_ISOT=[", SystemDateToLocalDate("2026-01-15T09:30:00"), "]"))
    OutputLine(Concat("--- fmt done ---"))
  ENDIF

  /* every branch below aborts the page - fetch them ONE at a time */
  IF @b == "s2lbad" THEN
    OutputLine(Concat("--- s2lbad start ---"))
    OutputLine(Concat("S2LBAD=[", SystemDateToLocalDate("not a date at all"), "]"))
  ENDIF

  IF @b == "l2sbad" THEN
    OutputLine(Concat("--- l2sbad start ---"))
    OutputLine(Concat("L2SBAD=[", LocalDateToSystemDate("not a date at all"), "]"))
  ENDIF

  IF @b == "s2lempty" THEN
    OutputLine(Concat("--- s2lempty start ---"))
    OutputLine(Concat("S2LEMPTY=[", SystemDateToLocalDate(""), "]"))
  ENDIF

  IF @b == "l2sempty" THEN
    OutputLine(Concat("--- l2sempty start ---"))
    OutputLine(Concat("L2SEMPTY=[", LocalDateToSystemDate(""), "]"))
  ENDIF

  IF @b == "s2la0" THEN
    OutputLine(Concat("--- s2la0 start ---"))
    OutputLine(Concat("S2LA0=[", SystemDateToLocalDate(), "]"))
  ENDIF

  IF @b == "s2la2" THEN
    OutputLine(Concat("--- s2la2 start ---"))
    OutputLine(Concat("S2LA2=[", SystemDateToLocalDate(@w, 1), "]"))
  ENDIF

  IF @b == "l2sa0" THEN
    OutputLine(Concat("--- l2sa0 start ---"))
    OutputLine(Concat("L2SA0=[", LocalDateToSystemDate(), "]"))
  ENDIF

  IF @b == "l2sa2" THEN
    OutputLine(Concat("--- l2sa2 start ---"))
    OutputLine(Concat("L2SA2=[", LocalDateToSystemDate(@w, 1), "]"))
  ENDIF
]%%

Availability

Platform Available
Marketing Cloud Engagement Yes
Marketing Cloud Next No

See also