I don't think there's any perfect amount of time per day to spend outside.
It's already been mentioned that some outdoor things such as air pollution can make going outside do more harm than good, though I guess with air pollution it depends on whether or not the indoor air quality is any better. I don't see why it would be if the incoming air wasn't being filtered so as to remove whatever pollutants were around.
There's also the question of UV light, which seems to be getting worse, so you might want suitable sunglasses, a wide-brimmed hat, and depending on how strong the sun is. You can also use sunscreen, but personally I'd rather not, because I don't entirely trust things they sell for rubbing on the skin. Talking of weather, beware of extreme cold, strong wind, lightning, etc.
Ticks are becoming a serious health hazard, so if you're in tick country you might want to avoid the grass. There are other dangerous animals in some areas - e.g. certain other insects, snakes, Deliveroo cyclists, reckless motorists, bent police officers, and muggers.
Still, as long as you know the hazards in your area and successfully mitigate them, being outdoors is a good thing and there's no upper limit on how long to be out there. Houses are for shelter, so as long as there's nothing to shelter from, you're probably better off outside.