Looking at the sun is never a good idea.
It could be dangerous. You probably are referring to how long after a dilated exam can you go out on a sunny day. With sunglasses, you can go out immediately. You will be more comfortable generally after 6-10 hours when the drops have worn off and your pupillary dilation ends.