[SalesForce] How does SystemDatetoLocalDate work in ET

Using AMPscript to try and allow our sales staff to enter items in UCT but have them display elsewhere in local time. I understand that the server uses CST which like UCT doesn't shift to or from Daylight savings. That said for the function I'm setting

SET @DateData = Field(@row, "DateTime")
SET @localDateData = SystemDateToLocalDate(@DateData)
SET @UCTConversion = DateAdd(@localDateData, "-8","H")

While this appears to set the time for now so it displays correctly what it's doing is allowing me to upsert a datetimestamp raw. So it's on the server like any other date time stamp and accurate only if we consider it to be in CST time. Then using the systemtolocal() function to process that system time to local time, then subtracting 8 hours is making the time appear on my EDT display to be the correct time.

If we want an event to begin at 9am here, we would enter it at 1p UTC. Since the "system" is using CST we need to account both for -6 hours offset from UTC and then adding another 2 for EST. I'm using system to local to avoid issues of Daylight savings but it's not responding when I change my system timezone.

I can add use dateadd to add the difference from CST to UCT on the upload and always correct for that with every edit or review of the record but that might be strange.

Note that when I used the script above it appeared correct at first, but when I used the control panel on my computer to change my time zone I was expected a change which didn't happen. So what is systemdatetolocaldate actually doing? Is it using IP time rather than a computers timezone setting? Any insights on this type of time conversion within ET will be useful.

Best Answer

I think the issue is that you are expecting the result to be the user machine's or browser system date. The SystemDatetoLocalDate() function is doing the following:

Converts a system datetime string or object to the user's local time.

It's the ExactTarget user setting for time zone, not your computer's time zone.

You would want to control the time zone based on the users location using something like javascript. Here is another StackOverflow question with more info.

Related Topic