I am getting the dynamic method error

Hi, I am getting the dynamic method error .

dynamic method [java.time.ZonedDateTime, toString/1] not found.

the issue sis related to datetime field.

epoch = (doc['field'].value).tostring("MM.dd.yyyy HH:mm:ss");

Could anyone help?

The toString() method on this class does not take an argument. See ZonedDateTime (Java SE 11 & JDK 11 )

Have a look at https://www.baeldung.com/java-format-zoned-datetime-string

Try:

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM.dd.yyyy HH:mm:ss");
String formattedString = (doc['field'].value).format(formatter);