cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Date in Salesforce acceptable format

darshthakkar
Valued Contributor

Hi Team,

I have 2 fields, Start and End Date coming from upstream systems (i.e. snowflake) in UTC and want this to be inserted to downstream systems (i.e. Salesforce) in UTC as well. After developing the pipeline, we found that the dates are off by 4 hours when it goes into Salesforce.

Thus, I tried changing the date to EST format in order to resolve the issue however at Salesforce, the dates are further going off by 4 hours.

Should I just add 4 hours in my mapper which formats date so that it goes as is in Salesforce? If thatโ€™s the case, how should I add those 4 hours? It seems like the Salesforce Org is GTM-4 therefore it always converts the time - 4hours.

Some screenshots for convenience.

  1. Snowflake execute with the below settings:
    image

  2. EST Add-on:
    image

With the EST add on, the dates on Salesforce is going as 2025-12-29T15:00:00Z which is 29 Dec 2025 3pm.

  1. Removed EST Add-on:
    image

While removing the EST add-on, dates on Salesforce is still going as (Date - 4 hours) i.e. 29 Dec 2025 8pm.

How can I tackle this?

Thanking in advance for your time.

Regards,
Darsh

1 ACCEPTED SOLUTION

darshthakkar
Valued Contributor

Based on how the Org has been setup in downstream systems, transformations must be made in snapLogic. For me, Salesforce Org is GMT-4 thus, I adjusted the date accordingly using

$Expire_Date.plusHours(4).toLocaleDateTimeString({format: "yyyy-MM-dd'T'HH:mm:ss'Z'"})

Moreover, it is vital to check the data type at the downstream systems as well. We may be ingesting wrong data and thus the dates might be off and not consistent. For example, Iโ€™m ingesting Date/Time but Salesforce Org is only Date then it wouldnโ€™t make sense.

Consequently, another function can also be used which is as below:

$Expire_Date.toLocaleDateTimeString({format: "yyyy-MM-dd'T'HH:mm:ss'Z'","timeZone":"GMT"})

$Expire_Date.toLocaleDateTimeString({format: "yyyy-MM-dd'T'HH:mm:ss'Z'","timeZone":"GMT+4"})

Closing this thread now as the issue has been found at the downstream systems and not with snapLogic plus it has been resolved too.
Thank you everyone for your time, help and inputs on this one.

View solution in original post

7 REPLIES 7

darshthakkar
Valued Contributor

I was putting the function at the wrong place but I was able to add the hours if I used the below string:

$Expire_Date.plusHours(4).toLocaleDateTimeString({format: "yyyy-MM-dd'T'HH:mm:ss'Z'"})

Iโ€™m not sure whether adding 4 hours to the transformation is a good practice as Iโ€™m a huge proponent of using time zones for ease.

Iโ€™ll keep everyone posted on this thread if I find something interesting, until then closing this thread.

This works however what throws me away is the fact that it doesnโ€™t work for a few, Iโ€™m anticipating errors on Salesforce side but is there a way I can better code this so the results remain consistent on the downstream systems as well?

Data in Snowflake:
image

Data in snapLogic going into Salesforce: (added 4 hours thus the difference in time)
image

Data ingested in Salesforce:
image

Expectation: Data in snowflake <==> Data ingested in Salesforce

CC: @koryknick @ptaylor @bojanvelevski

Regards,
Darsh

Transformation rule for converting the date into the following format: 2023-02-28T00:00:00.000 EST?

Iโ€™m currently using $Expire_Date.toLocaleDateTimeString({โ€œformatโ€:โ€œyyyy-MM-ddโ€™Tโ€™HH:mm:ss.SSSโ€,โ€œtimeZoneโ€:โ€œAmerica/New_Yorkโ€})+" EST" which is working on the output preview but unable to ingest records in the downstream systems i.e. Salesforce. Iโ€™m suspecting that the date format is causing an issue as previously without the modification of the Expire Date, the pipeline was able to ingest data downstream. Moreover, the same format of the data is able to go into Salesforce if we do it manually.