Reputation: 424
I'm using transform message component to transfer .csv file to another .csv file. input is coming in "YYYY/DD/MM HH:MM:SS" format but I need to transform to "MM/DD/YYYY" format.
Upvotes: 1
Views: 2626
Reputation: 1603
You can also give it a try with this expression
%dw 1.0
%output application/csv
---
formatedDate: |2003-10-01T23:57:59| as :string {format: "MM-dd-yyyy"}
For more date conversion you can refer to mulesoft document.
https://developer.mulesoft.com/docs/dataweave#_changing_the_format_of_a_date
Upvotes: 0
Reputation: 11606
You need to parse the string to a Date using the one format then back to string using another format something like so:
%dw 1.0
%output application/csv
---
[{
someDate: '2015/10/19 12:00:00' as :localdatetime {format: "yyyy/MM/dd H:mm:ss"}
as :date {format: "MM/dd/yyyy"}
} ]
Upvotes: 2