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

Suffixing date with date format abbreviation (e.g. EST, UTC, IST, etc.)

darshthakkar
Valued Contributor

Continuing the discussion from Date in Salesforce acceptable format:

Hi Team,

I actually need the following format for date: 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.

Do you agree that the transformation Iโ€™m using is correct? Is appending โ€œESTโ€ as a string causing an issue? How can I have EST embedded automatically without writing "+ โ€œESTโ€ "?

Also, if I need to have timezone of Mauritius for instance or Singapore, what would the function look like?

Thanking you in advance for your time.

Regards,
Darsh

1 ACCEPTED SOLUTION

@darshthakkar Can try this option- .toLocaleDateTimeString({โ€œformatโ€:โ€œYYYY-MM-ddโ€™Tโ€™HH:mm:ss zโ€,โ€œtimeZoneโ€:โ€œISTโ€}) will give you โ€œ2022-08-16T12:06:55 ISTโ€ format.

View solution in original post

5 REPLIES 5

darshthakkar
Valued Contributor

$Expire_Date.toLocaleDateTimeString({format: "yyyy-MM-dd'T'hh:mm:ss'EST'"})

@darshthakkar Can try this option- .toLocaleDateTimeString({โ€œformatโ€:โ€œYYYY-MM-ddโ€™Tโ€™HH:mm:ss zโ€,โ€œtimeZoneโ€:โ€œISTโ€}) will give you โ€œ2022-08-16T12:06:55 ISTโ€ format.

Thank you @Supratim, I was able to test this out and it worked!

Hi @Supratim ,

Can you please help me on this.

I have tried as mentioned

 

 Date.now().toLocaleDateTimeString({โ€œformatโ€:โ€œYYYY-MM-dd'T'HH:mm:ss zโ€,โ€œtimeZoneโ€:โ€œISTโ€}) 

which is giving me in UTC as below

_snaptype_datetime:"2024-03-12T09:15:05.038 UTC"