I'm familiar with the DateTime Formatter in regards to applying LocalDate to a single variable, but don't know how to handle the following situation:
I've two LocalDate variables, for example startOfWeek and endOfWeek.
And I need to create String result with following rules:

1. if startOfWeek and endOfWeek have same month and year, the result should be like
**3 - 9 Jan 2021** (just an example with format)
2. if startOfWeek and endOfWeek have not same month, the result should be like **31 Oct - 6 Nov 2021**
3. if startOfWeek and endOfWeek have not same year, the result should be like **27 Dec 2020 - 2 Jan 2021**

I didn't find how to apply DateTime Formatter working with two of more LocalDate variables, so I've made this way:

```
if ((startOfWeek.getYear() != endOfWeek.getYear())){
                result.append(startOfWeek.getDayOfMonth() + " " + startOfWeek.getMonth() + " " + startOfWeek.getYear() +
                        " - " + endOfWeek.getDayOfMonth() + " " + endOfWeek.getMonth() + " " + startOfWeek.getYear());
                return  result.toString();
            } else if ((startOfWeek.getMonth() != endOfWeek.getMonth())) {
                result.append(startOfWeek.getDayOfMonth() + " " + startOfWeek.getMonth() +
                        " - " + endOfWeek.getDayOfMonth() + " " + endOfWeek.getMonth() + " " + startOfWeek.getYear());
                return  result.toString();
            } else {
                result.append(startOfWeek.getDayOfMonth() +
                        " - " + endOfWeek.getDayOfMonth() + " " + startOfWeek.getMonth() + " " + startOfWeek.getYear());
                return  result.toString();

```

But it return information about months in default format, for example SEPTEMBER

[Full example:](https://i.stack.imgur.com/xrtj6.png)

Does anybody now how to fix month data format or how to use DateTime Formatter with two LocalDate variables at one time?
Thank you in advance for your help.