2

I am sending out emails from the Marketing cloud. The email template uses AMPScript from a Date time field in Salesforce. I only need to capture the Date part of the field, however, since the clocks have been moved forward this no longer works. Is this working as designed or is there a better way to manage the time stamp.

Var @CBDateTime, @CBDateString, @CBTimeString

  Set @CBDateTime = [Field in Salesforce]

  Set @CBDateTime = SystemDateToLocalDate(@CBDateTime)

  Set @CBDateString = Formatdate(@CBDateTime, "d MMMM yyyy","","en-GB")

  Set @CBkTimeString = Formatdate(@CBDateTime, "hh:00 tt","","en-GB")

This then displays as 08:00 AM and not 09:00 AM as per the field in Salesforce which contains 09/04/2018 09:00

1

It may be the "SystemDateToLocalDate", as that converts it to the user's time. For example, when I used that "SystemDateToLocalDate" 9AM in the Salesforce field converted to 11AM in the test email. This doesn't happen when I do not include "SystemDateToLocalDate". Below are some screenshots. Hope this helps!

Data Extension

AMPScriptfinal email preview

  • Thank you for the reply, although not fixed this did lead to a bit of a breakthrough. I was able to remove the local date and I was returned the same result. I then confirmed the 'raw' values in the SalesCloud and realised my time zone was not the same as the system (Mine was GMT+1 and System is GMT). It looks like the SalesCloud that the value comes from is storing the value -1hr as GMT (not GMT+1 for the summer). I need to add an hour to the value or find out why my SalesCloud is passing over GMT values to Marketing Cloud any ideas? – user48743 Apr 6 '18 at 11:55
  • hmmm. Well, our Marketing Cloud has it's own system timezone. And, I believe, can be set differently than SalesForce. I would check the Admin settings in MC (and SF) to see if there are differences in both to be sure. – Harley Apr 6 '18 at 12:21
  • I changed all of the time zones to the same and this didnt work so ive gone with the following to add an hour as they are from 9am - 8 pm uk region only. this is until i can find a long term solution. for now I need clients to see the right times in the emails: %%=v(Formatdate(DateAdd(@CBTimeString, '1','h'), "","HH:mm","en-GB"))=%% – user48743 Apr 6 '18 at 15:26
  • From what I understand, imported dates from Salesforce CRM are automatically converted to Salesforce Marketing Cloud system time (CST) in the Data Extension. This might help in your investigation. – Christopher Carswell Apr 10 '18 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.