class LocalDateUtil {

    public static String getFormattedDateForMongo(String date) {
        LocalDateTime ldt;
        try {
            ldt = LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
        } catch (DateTimeParseException e) {
            LOGGER.debug("Cannot use ISO_LOCAL_DATE_TIME formatter, try with Zoned one");
            try {
                ldt = LocalDateTime.parse(date, ZONED_DATE_TIME_FORMAT);
            } catch (DateTimeParseException ex) {
                LOGGER.debug("Cannot use Zoned LOCAL_DATE_TIME formatter, try with ISO_DATE one and time to " +
                    "00:00:00.000");
                try {
                    ldt = LocalDate.parse(date, DateTimeFormatter.ISO_DATE).atTime(0, 0, 0, 0);
                } catch (DateTimeParseException exc) {
                    LOGGER.debug("Cannot use ISO_DATE formatter, try with SLASH_DATE on and set time to 00:00:00.000");
                    ldt = LocalDate.parse(date, SLASHED_DATE).atTime(0, 0, 0, 0);
                }
            }
        }
        return getFormattedDateForMongo(ldt);
    }

    private  LocalDateUtil();

}