Without seeing the rest of your code it's difficult to say how this is used, but I think your function has conflated logic and formatting, and formatting is being done too soon. You should hold onto real date information right up until the edges of your program when that's possible. The following demonstrates one way of keeping dates and moving them to the ...
Overall, it looks fine. I probably would've written it a little differently, and I'll explain the differences.
"""A function that returns an array
with all the actual year quarters
current_year = datetime.date.today().year
quarter_values = ["31/03/","30/06/...
datetime.date has a .replace() method that returns a copy with some values changed. This can be used to get the date 18 years ago.
end_date = date.today()
start_date = end_date.replace(year=end_date.year - 18)
datetime.date.toordinal returns an integer corresponding to the date. The ordinals for the start and stop date can be used in random.randint() to ...
Please don't do this:
using namespace std;
We have namespaces for good reason, and it's a bad habit to throw away their benefits like that.
bool create_date_again = true;
This looks like something written by a (quite old) C programmer. Prefer to declare variables where they can be initialised, rather ...
If the goal is to compute a date 10,000 days from now, I would strongly recommend using the std::chrono facilities. If you do, the code would be only a few lines long:
using namespace std::chrono;
It's not common practice to use exceptions when validating user input. A simpler approach would be for the Date class to provide a static member function to check whether it's constructible from the given arguments:
static is_valid(int y, int m, int d);
Date(int y, int m, int d);
Then instead of throw/catch, we can read input ...