JSON date format

Hello,

I’ve exposed a service bean to the REST services, that returns a list of entity instances according to a custom business logic. The createTs and updateTs fields are formatted according to the pattern “MMM dd, yyyy hh:mm:ss a” by default. I was wondering if there’s any option that allows me to change the default date serialization format, because in our business rules milliseconds can make a huge difference in the results.
I tried setting the dateTimeFormat property within the project properties, but it didn’t have any effect.
So is there a solution to explicitly specify how should the date be serialized?

Regards,
Julien Saab.

3 Likes

Hi,
By default, REST API uses default date format when it serializes date datatypes. It is taken from the datatypes.xml file. For DateTimeDatatype it is “yyyy-MM-dd HH:mm:ss.SSS”, not the “MMM dd, yyyy hh:mm:ss a” as you written in your question. Did you replace the datatypes.xml file in your project?

No I haven’t

Please try to reproduce the problem in a small separate demo-project. Just create one entity, try to get it with REST API and see the result.