The body synthesizes vitamin D when the skin is exposed to the sunlight. Sunlight itself does not provide vitamin D to the body. Vitamin D promotes calcium absorption and bone health. Sunlight consists of both ultraviolet A (UVA) and ultraviolet B (UVB). Ultraviolet B helps in the synthesis of vitamin D. Staying in the sun for 10 minutes a day is adequate. You can not get enough UVB rays staying indoors because the glass blocks UVB rays. Sitting in front of a sunny window or inside the car doesn't help you get vitamin D. However, UVA radiation will penetrate the glass and may be harmful.
Spending time out in the sun is the best way to get vitamin D. However, sufficient exposure to sun may be difficult for many people. The best dietary source for vitamin D is cod liver oil. Other dietary sources are canned tuna, egg yolk, mushroom, and fortified cereals.