Getting Vitamin D from the Sun WITHOUT the Skin Cancer

On the other hand, low vitamin D levels have been linked to serious health consequences, including:
Osteoporosis
Cancer
Depression
Muscle weakness
Death
In addition, only a handful of foods contain significant amounts of vitamin D.
These include cod liver oil, swordfish, salmon, canned tuna, beef liver, egg yolks and sardines. That said, you would need to eat them nearly every day to get enough vitamin D.
If you do not get enough sunlight, it’s often recommended to take a supplement like cod liver oil. One tablespoon (14 grams) of cod liver oil contains more than three times the recommended daily amount of vitamin D.Another study found that 30 minutes of midday summer sun exposure in Oslo, Norway was equivalent to consuming 10,000–20,000 IU of vitamin D (8Trusted Source).
The commonly recommended daily dose of vitamin D is 600 IU (15 mcg) (3Trusted Source).
Not only is getting vitamin D around midday more efficient, but it might also be safer than getting sun later in the day. One study found that afternoon sun exposure may increase the risk of dangerous skin cancers 
https://www.healthline.com/nutrition/vitamin-d-from-sun#time-of-day