Search code examples
datemuledatamapper

Mule - Date format from m/dd/yy to yyyy-mm-dd


want to convert date to the above required format. Is it possible to write a groovy script to do so in datamapper? If yes can you please give an example. Or can i reference another expression or component?


Solution

  • I think the simplest way to do what you need is to edit the datamapper script and replace the line where you perform the date mapping for this one:

    output.date = date2str(str2date(input.date,"d/mm/yy"), "yyyy-mm-dd");
    

    but replacing the input and output fields accordingly.