Date format from middleware service not working

Hello CUBA personnel!

I’ve recently moved a bunch of code from a screen controller to a service so that it can be accessed from multiple screens. The only problem I’m facing is that all of the dates are showing as dd/MM/yyyy. This is specified in the project properties as Locale: en, and I even specified it in the Main Message Pack as “dateFormat=MM/dd/yyyy”.

Is there an additional step I need to take?


Side note: I’m formatting using datatypeFormatter.formatDate(), as in:

String assembledByDate = job.getAssembledByDate() != null ? datatypeFormatter.formatDate(job.getAssembledByDate()) : " ";

This had been working in the screen controller, but no longer is formatting as specified.


Hi Adam,

When you set a format string in locale settings in Studio, it is only written to the main message pack of the web module. The core module where your service runs, has its own main message pack specified in the file of the core module, e.g.:

cuba.mainMessagePack =

So if this file doesn’t exist, create it (e.g. modules/core/src/com/company/demo/core/ and write your format there:

1 Like

Hello Konstantin,

Thanks for this! It solved my issue!