0

I have a java POJO with string type date "2022-01-01T00:00:00.000Z". When I save it to mongodb, it converts to "Fri Dec 31 16:00:00 PST 2021" format. How can keep the original format?

harryk
  • 123
  • 1
  • 10
  • The answer you are looking for is here -> https://stackoverflow.com/questions/23972002/java-8-date-time-jsr-310-types-mapping-with-spring-data-mongodb – P H Jun 21 '22 at 06:30

1 Answers1

0

Do you set the field type as String? Test this. This must be working correctly for you.

public class Person{
   ...
   private String dateStringFormat;
}