2017-02-15 107 views
0

我無法使用Mulesoft DataWeave將Date有效轉換爲DateTime。出於某種原因,Mulesoft將日期視爲字符串。無法將a:字符串強制轉換爲:datetime

我該怎麼辦才能解決此問題並正確轉換日期?我試圖去的格式是yyyy-mm-ddmm/dd/yyyy hh:mm:ss

錯誤:

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"} 

在上面的例子,flowVars.SalesforceAccount.Contract_End_Date__c是日期,和DateCustomFieldRef__custentity_icims_legacy_f_next_renewal是DATE_TIME在NetSuite的。

回答

0

按照Mule Type Coercion Table:日期到:日期時間強制不可能。你必須添加下面的時間來獲得預期的結果。隨着時間的將是默認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