0

I am unable to use Mulesoft DataWeave to effectively transform a Date to a DateTime. For some reason, Mulesoft is treating the Date as a String.

What can I do to fix this issue and convert the date properly? The format I am attempting to go from is yyyy-mm-dd to mm/dd/yyyy hh:mm:ss.

Error:

Cannot coerce a :string to a :datetime, caused by :Text '2019-03-08' could not be parsed at index 2.

DataWeave

DateCustomFieldRef__custentity_icims_legacy_f_next_renewal: flowVars.SalesforceAccount.Contract_End_Date__c as :datetime {format: "dd/MM/yyyy HH:mm:ss"}

In the example above, flowVars.SalesforceAccount.Contract_End_Date__c is a DATE, and DateCustomFieldRef__custentity_icims_legacy_f_next_renewal is a Date_time in NetSuite.

1 Answer 1

1

As per Mule Type Coercion Table :date to :date time Coercion not possible. You have to append time something like below to get expected result. As time will be default 00:00:00

%dw 1.0
%output application/java
---
("2017-02-15" ++ "00:00:00" )as :localdatetime  {format: "yyyy-MM-ddHH:mm:ss"} as :string {format: "dd/MM/yyyy HH:mm:ss"}

HTH

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.