Assuming you use it correctly, if you’d burn after 20 minutes in the sun, an SPF 30 sunscreen protects for about 10 hours. But intensity and wavelength distribution of UVB rays vary throughout the day and by location. And that calculation does not apply to UVA rays.