I converted an Instant to LocalDateTime in Java with Spring Boot as seen below
LocalDateTime.ofInstant(timeInUtc, zoneId);
In my test I got a Regex to check whether my resource returns a Json with a LocalDateTime. The Regex expects a JSON value in the format:
2018-11-15T08:38:49.382
But it looks like the trailing zero is removed, meaning instead of
2018-11-15T08:38:49.380
which would comply to the regex, I get
2018-11-15T08:38:49.38
How can I make sure that the trailing zero is not removed?
Formatting the date would help to retain the trailing zero
Output looks like below:
The code below:
EDIT Adding regex matching to match date time with and without milli seconds.
output: