0

I am attempting to populate Rewards Card Object in Salesforce CRM using AMPscript.

SET @CRMIssuancedate = Concat(FormatDate(StringToDate(@Issuancedate),'yyyy-MM-dd',''),'T',FormatDate(StringToDate(@Issuancedate),'','HH:mm:ss'),'+11:00')

I have managed to populate the date and time in the correct format with an offset of 11 hours by concatenating with Date and Time.

Value passed to CRM: 2018-02-14T13:44:07+11:00

Value in CRM: 14/02/2018 1:44 PM

The problem is the Daylight Saving which doesn't accomodate with the static offset.

Is there a way to automatically update the date and time field in CRM irrespective of when the Daylight Saving starts?

2

1 Answer 1

0

With some help, I have figured this out. Generally the standard back-end time in SFMC is in CST and the timezone in Australia is AEST or AEDT depending on the Daylight saver.

The solution takes the difference between the AEDT and AEST to determine the daylight saver. Also depending on the difference the offset can be managed which then can be used to update the CRM date-time field in UTC.

Here is the code below:

%%[
SET @LocalDate = SystemDateToLocalDate(Now(1))
SET @SystemDate = Now(1)
SET @TimeDiff = DateDiff(@SystemDate,@LocalDate,'H')
SET @Offset = IIF(EMPTY(@TimeDiff),11,IIF(@TimeDiff==17,11,10))
]%%

The variable @Offset will output 11 during AEDT and 10 during AEST.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .