We use action spectra published by the International Commission on Illumination to examine diurnal, seasonal and latitudinal variations in erythemally weighted (sunburning) UV-a health risk, and vitamin D-weighted UV-a health benefit. Vitamin D-weighted UV is more strongly dependent on ozone and solar zenith angle. Consequently, its diurnal, seasonal and geographic variability is more pronounced than for erythemally weighted UV. We then investigate relationships between the two quantities. An algorithm is developed and used to relate vitamin D production to the widely used UV index, to help the public to optimize their exposure to UV radiation. In the summer at noon, there should at mid-latitudes be sufficient UV to photosynthesize optimal vitamin D in similar to 1 min for full body exposure, whereas skin damage occurs after similar to 15 min. Further, while it should be possible to photosynthesize vitamin D in the winter at mid-latitudes, the amount of skin that must be exposed is larger than from the hands and face alone. This raises the question of whether the action spectrum for vitamin D production is correct, since studies have reported that production of vitamin D is not possible in the winter at mid-latitudes.