Mule: Dataweave - date formatting from strings
<p>I've been searching around and can't find (or didn't recognize) a solution to this issue. I'm very new to MEL, so please be kind. :)</p>

<p>I am building a service that will accept 2 dates as strings. I want to be able to accept any (within reason) legitimate string representation of a date and coerce it to a specific format.</p>

<p>So far; everything I try results in errors. To somewhat simplify the process for now, I've started with a string in Dataweave instead of using the actual input for now.</p>

<p>I have this statement:
startDate: '2016/11/25 12:00:00' as :localdatetime {format: "yyyy/MM/dd HH:mm:ss"} as :date {format: "yyyymmdd"},</p>

<p>I get this in response:
Cannot coerce a :date to a :string, caused by :Unsupported field: MinuteOfHour.</p>

<p>I also tried this:
startDate: '2016/11/25 12:00:00' as :date {format: "yyyymmdd"},</p>

<p>I get this response:
Cannot coerce a :string to a :date, caused by :Text '2016/11/25 12:00:00' could not be parsed at index 4.</p>