Your body makes vitamin D when your skin is exposed to the ultraviolet B (UVB) rays in sunlight. About 5 to 30 minutes of exposure to the skin on your face, arms, back or legs (without sunscreen) two times every week is enough. But, too much exposure to sunlight is a risk for skin cancer, so you should use sunscreen after a few minutes in the sun, even on hazy or cloudy days.