All sunscreens are physical barriers, designed to absorb or reflect UV radiation. They rub off over time, and they will rub off faster when exposed to water/moisture, most commonly from sweating or swimming. Friction (e.g. from towel-drying) also removes sunscreen.
Some chemical sunscreens do break down when exposed to sunlight and require the addition of other chemicals as stabilizers. This is less of a concern with mineral (zinc or titanium oxide) sunscreens.
The most common recommendation is to reapply sunscreen every 2-3 hours, but this doesn't take into account many variables such as individual sun-sensitivity, SPF of the sunscreen, and type/level of activity. So the 2-3 hour guideline is a blanket recommendation that won't necessarily prevent one from burning. In fact, a 2001 study suggests that earlier re-application is more effective:
Advice given to sunscreen users should be to apply sunscreen liberally to exposed sites 15 to 30 minutes before going out into the sun, followed by reapplication of sunscreen to exposed sites 15 to 30 minutes after sun exposure begins. Further reapplication is necessary after vigorous activity that could remove sunscreen, such as swimming, towelling, or excessive sweating and rubbing.
As for claims of all-day (or x-hour) protection, time estimates are based on a rough calculation using SPF. According to the Environmental Working Group,
SPF is a measurement of sunburn protection, primarily caused by UVB rays. If your skin would normally burn after 10 minutes in the summer midday sun, for example, wearing a thick layer of an SPF 15 sunscreen would theoretically allow you to stay in the sun for 150 minutes (10 x 15) without burning. This is a rough estimate, however, and your own skin, the type of activities you do in the sun (e.g. involving water or sweat) and the intensity of sunlight may affect how much safety it gives you. SPF ratings can be confusing or misleading. The numbers do not reflect the degree of protection from UVA rays, which cause skin aging, immune suppression and cancer. The FDA has warned that high-SPF products can create a false sense of security, contain higher concentrations of allergenic or irritating ingredients and offer little additional sun protection (Branna 2011).
Moreover, manufacturer claims are likely based on a best-case scenario that would involve applying a thick layer ~20 minutes before going outdoors to allow for the lotion to bind to the skin, minimal sweating and friction, and perhaps even use of additional protection measures such as a hat or umbrella.