+1 vote
1 view
in Salesforce by (11.9k points)

I am trying to convert a datetime column in a CSV to a salesforce datetime format to do an upsert. I tried expression like below in mule-3.8.4 dataweave1.0 but I am getting an error.

I tried the following:

Test_Date: "1/14/19 6:31 PM" as :localdatetime { format: "M/dd/yy h:mm a" } as :localdatetime { format: "YYYY-MM-DD'T'hh:mm:ssZ" })

Expected Output : 2019-01-14T06:31:00Z

Actual Output : Mon Jan 14 18:31:00 EST 2019

After Upsert in Salesforce, it looks like this: 2019-01-14T00:00:00.000+0000. It is not saving the time.

What is the problem?

1 Answer

+1 vote
by (30.1k points)

To format a date, the format pattern reading left to right, needs to match your expected output. So for your example:



y is for year M is for Month(lowercase m is for minute

d is for day

H is for hour in 24 hr format. (Lowercase would be 12 be format)

S is for milliseconds

And Z is time zone There’s more you can configure for time zone and milliseconds if needed.

Here are the salesforce date format info:


More date format info:


Welcome to Intellipaat Community. Get your technical queries answered by top developers !