In the light of the demonization of sunlight we see these days, it is good to realize that exposure to Sol's radiation not only causes skin cancer, skin ageing, and sunburn, but also has positive effects on our health and well-being. Were we to take the advice from concerned dermatologists literally, we would have to protect our skin from the sun the whole year through (not just in summer!) every hour of the day from sunrise to sunset (not just during the part of the day when the sun is high above the horizon!) even in cloudy weather (not just when the sun actually shines!) even under thin clothes (not just the exposed skin!) even indoors behind glass (so not just when going out!) and even when living at higher latitudes (not just in the hot and sunny parts of the world!) It is easy to see that this would cost a small fortune per individual per year in sunscreen, also considering that such needs to be reapplied every one to two hours. And while it would prevent some of the harm the sun could cause, it might also keep us from receiving certain beneficial effects of its radiation.
The part of the sun's electromagnetic spectrum that reaches the Earth's surface and affects humans directly can be broken down as follows:
Frequencies higher than U.V. B, such as U.V. C, Röntgen, and gamma radiation, do not reach the surface of the Earth; the higher the frequency (so, the shorter the wavelength) the less penetration the radiation has, and the easier it is blocked or filtered out by various layers or girdles around the Earth. Frequencies lower than infra-red include microwaves and radio waves; these do reach the surface, but do not affect humans directly, but they can affect electric or electronic equipment.
Any radiation from the sun's spectrum, from ultraviolet to infra-red, may damage your eyes, and ultraviolet and infra-red in particular may also damage your skin and, in the case of infra-red, the underlying tissues. So watch it (not the sun though; never watch the sun)!
Ultraviolet radiation is the most controversial part of sunlight, the question being whether its benefits outweigh its harms. It can do damage to the skin, eventually leading to cancer, hence the traditional advice (no longer current) to stay out of the sun in summer during the part of the day when the sun is high above the horizon, mostly cited as being from three hours before solar noon to three hours after solar noon. Notice that solar noon is mostly not the same as clock noon, depending on your time zone; for instance, in the west of Europe, solar noon in summer falls around 14:00 hours due to the combination of Central European Time and Daylight Savings Time. Exposure to ultraviolet is higher around solar noon because (1) the angle at which the radiation reaches the surface is greater, so a given amount of radiation is concentrated on a smaller surface and (2) the radiation has a shorter path through the atmosphere so less of it is blocked.
Since shorter wavelengths are filtered out the easiest, you will receive less ultraviolet, the lower the sun is above the horizon, all other circumstances remaining the same. And within the ultraviolet range, U.V. B (shorter wavelength) is blocked first, so that in the morning and evening, and outside the summer period, you will receive relatively less U.V. B compared to U.V. A, or even none at all. This is relevant because of the different effects ascribed to these variants of ultraviolet; U.V. B is said to cause cancer and sunburn, while U.V. A, which penetrates deeper into the skin due to its longer wavelength, is said to cause skin ageing and redness. However, U.V. B also causes the skin to tan and become thicker, which then protects that skin from further damage by ultraviolet exposure. Avoiding only the part of the day when U.V. B exposure is greatest may therefore not be wise, as it leaves you vulnerable to skin ageing by U.V. A at other times without letting you develop the protective tan and skin thickening that exposure to U.V. B would cause. This argument is typically used to justify the current recommendation to protect yourself from sunlight every day of the year, the whole day, in any weather, even under thin clothes, even indoors behind glass, and even at higher latitudes; after all, U.V. A may reach your skin under each of those conditions, causing it to age.
Studies tend to show though that people who have worked outdoors for much of their lives have less skin cancers than has the population at large, which suggests that the benefits of exposure to sunlight may outweigh the harms. The fact that cancer is hugely less prevalent in the regions around the equator, where sunshine is more intense than at higher latitudes, points in the same direction (both phenomena may have other explanations too though). Apart from the protective effect of tanning and skin thickening caused by U.V. B, there are important health benefits associated with ultraviolet: It causes the synthesis of vitamin D and the release of nitric oxide (NO) in the skin. Vitamin D helps the body absorb calcium, and has other beneficial effects, such as in relation to the immune system. Nitric oxide causes the smooth muscle cells of blood vessels to relax, thus dilating (widening) the vessels, increasing blood flow and lowering blood pressure. Nitric oxide also plays a role in the nervous system and in the immune system, and more. Both vitamin D and nitric oxide are essential with regard to health and longevity. The synthesis of vitamin D is attributed to U.V. B; the release of nitric oxide, from forms like nitrate and nitrite, to U.V. A (and infra-red).
A point of debate is whether or not the use of sunscreen prevents the formation of vitamin D; manufacturers of sunscreen say it does not, but logic dictates that when you stop ultraviolet from penetrating the skin — or whenever you limit your exposure to sunlight, for that matter — you will also stop or reduce any processes in the skin that would be caused by U.V. irradiation.
Then another point of concern is how much ultraviolet you need to avoid becoming deficient in vitamin D; dermatologists say that only a minimal amount is required, like five to ten minutes of exposure to the arms and legs, or hands, arms, and face, two to three times per week. However, seeing how common vitamin D deficiency is at moderate and higher latitudes — it is endemic, in fact — this may be too optimistic. Lack of ultraviolet exposure, with the concomitant lack of vitamin D and health problems, may be a bigger problem than excess of ultraviolet exposure with the concomitant skin cancer and skin ageing. It might just be the case that following the present-day, overly careful advice (regarding protecting yourself from the sun and using products with a high sun protection factor) poses a greater threat to your health and longevity than does the risk of skin cancer caused by excessive U.V. exposure. In any case, to receive the health benefits of ultraviolet, it seems you need both U.V. B and U.V. A, which means you need to expose yourself to sunlight regularly, not just when the sun is low like in the morning and evening, but also when the sun is high so that its U.V. B can actually reach your skin.
If concerned about skin ageing at visible and always exposed locations like your face and hands, you may try protecting those with a hat and gloves or sunscreen, and exposing your legs and trunk for a while at times when the sun is high to catch the needed ultraviolet.
It is interesting to establish whether the sun is high enough to produce vitamin D at any given time; it is said the sun's angle with the horizon needs to be greater than 45 degrees in order for enough U.V. B to reach your skin to do so. When standing with your back to the sun, your shadow will be shorter than your height in that case. If your shadow is longer than you, the angle is less than 45 degrees, and you are not receiving U.V. B and producing vitamin D.
A reservation must be made with regard to the above claim that vitamin D deficiency is endemic at moderate and higher latitudes: This notion of deficiency is based on the current way of measuring vitamin D levels in the blood. One measures only the storage form of the vitamin (called "25-hydroxy vitamin D") and not the active form, and one has set the threshold for deficiency higher than it was some decades ago (30 nanograms per millilitre is now a common minimum to be sufficient). Were the threshold set lower, or were one to measure the active form of the vitamin, fewer people would/might be found deficient than is now the case. So the question whether there really is a widespread deficiency is valid, but lies outside the scope of the present article.
Exposure to sunlight affects the levels of certain neurotransmitters, while these levels, in turn, affect behaviour. Sunlight entering through the eyes influences the pituitary and pineal glands, which control the endocrine system. Important neurotransmitters in this respect (without claiming they are the only ones at play) are dopamine, serotonin, and melatonin. The levels of the first two rise when one is exposed to light, the last drops. This constitutes an activating, rewarding impulse on the whole. One feels better and wants to go out into the sun rather than stay indoors. This behavioural response to sunlight can be readily observed whenever and wherever the sun shines again after a cloudy period, even in non-human animals. The impulse to go out and be active when the sun shines (again) is so strong and universal that it almost must be an evolutionary adaptation, its value being, for instance, to make humans collect the amount of ultraviolet irradiation they require to survive, and/or to receive other benefits of exposure to sunlight. Another such adaptation is the white skin of Europeans; it evolved to enable the production of more vitamin D by letting in more ultraviolet. The beneficial effects of visible light are also used in light therapy, for example to treat certain forms of depression.
Visible sunlight entering the eyes affects other hormones than neurotransmitters too, incidentally.
Infra-red (thermal) radiation, due to its wavelength longer than that of visible light, can penetrate several centimetres deep into the body. Thus it reaches skin, nerves, muscles, tendons, bones, blood vessels, and other tissues directly. This has an immediate relaxing, calming effect. Infra-red therapy is frequently used to treat muscle pain and other conditions of the kinetic apparatus, and is also reported to have effect on facial tics. Interestingly, like ultraviolet, infra-red causes the release of nitric oxide, and does so in deeper-lying structures like blood vessels. Remember that nitric oxide dilates the blood vessels, lowering blood pressure, among other profitable effects.
Exposure to sunlight is beneficial and necessary for one's health; at moderate and higher latitudes, lack of such exposure may be a greater problem than an excess of it resulting in skin cancer and skin ageing. Since there are more benefits to sunlight than just vitamin D synthesis, merely taking a vitamin D supplement may not suffice to compensate fully for a lack of sunlight exposure. Besides, given that humans have evolved to take advantage of the sun's radiation, in whose interest is it to subsequently hide from the sun and take pills to compensate for the lacks thus caused? The current advice regarding the use of sunscreen and avoidance of sunlight may be exaggerated and even be doing more harm than good to your health and longevity, if taken literally. However, exposure should in any case remain limited to the extent that sunburn is avoided.
As an aside, it should be studied whether the problem of vitamin D deficiency is really as widespread as is nowadays assumed by some based on measurements of blood levels.
While most of the benefits referred to above are fairly common knowledge and do not need further illustration, the matter of nitric oxide, its effects, and its relation to ultraviolet and infra-red, is less known. A few sources regarding this are given below:
Although not the main topic of the study, the following contains some information of the functions of nitric oxide (NO) and its release by ultraviolet irradiation: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6072359/
Some information on infra-red therapy, including its role in the production of nitric oxide: https://www.news-medical.net/health/Infrared-Therapy-Health-Benefits-and-Risks.aspx