Vitamin D refers to vitamin D2 (ergocalciferol) or vitamin D3 (cholecalciferol).
(Vitamin D is a group of fat-soluble secosteroids responsible for increasing intestinal absorption of calcium, magnesium, and phosphate, and many other biological effects.)
Ergocalciferol is produced from irradiated fungi or yeast. Cholecalciferol is produced in skin or found naturally in fatty fish such as salmon or mackerel. Both forms of vitamin D can be used to fortify food; however, only cholecalciferol can be made endogenously in skin. When the skin is exposed to ultraviolet B (UVB) radiation between the wavelengths of 290 and 315 nm, 7-dehydrocholesterol, a compound present in the skin, is converted to previtamin D3.
(Source of Information: ncbi.nlm.nih.gov & Wikipedia)