0

I am tryng to build a Date fromat conversion in Mule using dataweave. The problem is: I am receiving the Date information as: 'Thy Feb 17 00:00:00 BRT 2022'. I need to transform this to the format YYYYMMDD. I try to create my specific function but the problem start when Mule tries to parse the received date as a date.

  'Thu Feb 17 00:00:00 BRT 2022' could not be parsed at index 0.

Can you guys help me with that transformation?

ChelloFera
  • 349
  • 1
  • 3
  • 16
  • Does this answer your question? [Converting to a date format in Mule using DataWeave](https://stackoverflow.com/questions/33075127/converting-to-a-date-format-in-mule-using-dataweave) – aled Oct 03 '22 at 16:45
  • I think that my problem is this 'BRT' as time zone in the middle of the string... It looks like Datetime don´t accept it. – ChelloFera Oct 03 '22 at 16:59
  • No built the format LocalDateTime {format: "EEE MMM dd kk:mm:ss zzz yyyy"} for 'Thy Feb 17 00:00:00 BRT 2022' the result was: 'Cannot coerce LocalDataTime (|2022-02-17T00:00:00| as LocalDateTime {format: "EEE MMM dd kk:mm:ss zzz yyyy"}) to String, caused by: Unable to extract ZoneId from temporal 2022-02-17T00:00:00' – ChelloFera Oct 03 '22 at 17:09
  • Thy for Thursday?? Ideally it should be Thu @ChelloFera – Karthik Oct 03 '22 at 20:14

1 Answers1

0

I got it! In my case, it was an env configuration in the Java VM options. Go to the menu 'Run->Run Configurations' and select the tab 'Arguments'. In the field 'VM arguments' add the Java Options: "-Duser.language=en -Duser.country=US -Duser.varian=EN"

This solves the problem for me!

ChelloFera
  • 349
  • 1
  • 3
  • 16
  • The names for days and months are dependent on the locale of the JVM. If you are running in an OS configured with a different locale it makes sense the names don't match. – aled Oct 04 '22 at 14:00