I have heard that sunburns do not become skin cancer immediately. How many months or years does it take for a sunburn to become skin cancer?

My friend recently had a sunburn. Her sunburn was not healing and it became worse, so she went to a dermatologist 3 months after the sunburn happened. The dermatologist found that she has skin cancer. Could it be that she had skin cancer all along, and the recent sunburn did not cause her cancer?