| String startDate = "2024-01-01 01:01:01";
        String endDate = "2024-11-11 01:01:01";
        Pattern compile = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})");
        Matcher matcher = compile.matcher(startDate);
        String startDateStr = null;
        if(matcher.find(0)){
            startDateStr = matcher.group(0);
        }
        Matcher matcher1 = compile.matcher(endDate);
        String endDateStr = null;
        if(matcher1.find(0)){
            endDateStr = matcher1.group(0);
        }
        System.out.println(startDateStr);
        System.out.println(endDateStr);
 |