Vitamin D is called the "sunshine vitamin" because the body synthesizes its own Vitamin D when skin is exposed to sunlight. Small amounts are available in a handful of natural foods, though most of the Vitamin D in American diets comes from fortified foods. The type of Vitamin D synthesized from the sun's ultraviolet rays is Vitamin D3, or cholecalciferol. Vitamin D2, or ergocalciferol, originates in plants. Once in the system, both are converted by the liver and kidneys into an active form, 1,25-dihydroxyvitamin D, which is involved in several essential functions.
Health authorities scratch their heads over sunlight recommendations since UV exposure is the leading cause of skin cancer. Once you sort out the mixed messages, the upshot is that a little UV exposure without protection - about two half-hour periods in mild sun per week - is probably adequate, with Vitamin D supplies to be topped off by fortified foods. The amount of D that you derive from sunlight should be qualified by what you know about your own susceptibility to skin cancer, paying attention to risk factors such as skin type, geographical location, and family history.