There are several different kinds of skin cancer, each of which can be associated with sun exposure. Squamous cell carcinoma and basal cell carcinoma are the two most common varieties, and they are both typically caused by direct damage to deoxyribonucleic acid (DNA) in the skin. Melanoma is a more serious variety of skin cancer that is caused by indirect damage to the DNA of the skin. DNA can be damaged in a variety of ways, though the ultraviolet-a (UVA) and ultraviolet-b (UVB) radiation present in sunlight are leading causes. Since UVA and UVB can cause mutations in DNA, it is possible to get skin cancer from the sun.
Each kind of skin cancer results from some type of genetic damage that causes malignant growths. This genetic damage can be traced to a number of different causes or contributing factors, such as tobacco smoke, arsenic poisoning, and certain kinds of skin ulcers. Many cases that involve getting skin cancer from the sun can also be associated with one of these contributing factors, though DNA damage from radiation is often the primary cause.
Direct DNA damage involves photons from UVB radiation being absorbed by a DNA strand. This results in a condition commonly referred to as sunburn and also triggers the production of melanin, which is responsible for the phenomenon of tanning. DNA that has been damaged in this way typically can not be copied. These damaged pieces of DNA are usually removed naturally, though cumulative effects can cause mutations that eventually lead to the formation of tumors. Skin cancer from the sun that is associated with this type of direct damage is usually classified as a basal or squamous cell carcinoma.
DNA can also be damaged indirectly by the sun when photons from radiation are absorbed by chromophores, which are the parts of molecules responsible for coloration. A chromophore that has absorbed a photon in this way will tend to exist in an excited state that can adversely affect DNA over a relatively long period of time. When this type of indirect damage causes someone to get skin cancer from the sun, the result is usually a melanoma. This is the least common kind of skin cancer, though it is also the most deadly.
There are certain times of day and other conditions that are strongly associated with getting skin cancer from the sun. Depending on the part of the world, UV radiation from the sun is typically strongest between the hours of 10am and 4pm, so exposure during those hours can be particularly dangerous. Overcast days typically aren't more dangerous than clear days, though a substantial amount of UV radiation can penetrate clouds. Since many people do not wear protective sunscreen on cloudy days, this can result in getting skin cancer from the sun.