SystemDateToLocalDate
→ stringConverts an SFMC system (server) date to the subscriber's local timezone date.
Available in:
Email
CloudPage
Automation
Triggered Send
Syntax
Platform.Function.SystemDateToLocalDate(date)
1 argument
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
date |
string | Yes | System date to convert to subscriber’s local time |
Description
Converts the SFMC system date to the subscriber’s local timezone, using the subscriber’s timezone setting in SFMC. Only available in email/send contexts where subscriber data is available.
Example
var serverTime = Platform.Function.Now();
var localTime = Platform.Function.SystemDateToLocalDate(serverTime);
function formatDate(dateString,dateFormat,timeFormat,isoLocale) {
Platform.Variable.SetValue("@formatDate_string",dateString);
Platform.Variable.SetValue("@formatDate_date",dateFormat);
Platform.Variable.SetValue("@formatDate_time",timeFormat);
Platform.Variable.SetValue("@formatDate_iso",isoLocale);
return Platform.Function.TreatAsContent("%%=FormatDate(@formatDate_string, @formatDate_date, @formatDate_time, @formatDate_iso)=%%");
}
Write("Your local time: " + formatDate(localTime, "M/D/YYYY H:MM"));