Im working on a project that visually displays statistical data from each month and week and i dont know how to elegantly renew the dates of each week and month.
For example, i want to display this months data. I have to make two date variables in Java. The first one being 1.5.2021 and the second one being todays date. I dont know how to elegantly set the first variable to 1.x.xxxx without making a string out of the current date first and then cuting it, doing some numerics with it and merging it back together to 1.5.2021.
Same goes for weekly statistics where i need the Monday date and the Sunday date, for example today being Monday 10.5.2021 and the end on 17.5.2021.
So my idea is to get current date to string format, slice it, convert it to int, calculate the desired dates and the put it back to string(no need to go back to datetype since its gonna be used for querying).