skeleton AI makes them stay under trees when it's bright enough to burn
as long as they're out of direct sunlight (1x1 floating block in the sky is enough), they will go stand under it
pretty sure zombies are dumb and don't hide, just accidentally stay there at best