hmmmmmmmm.....somehow I get the feeling this might be a rhetorical question :-)
The two primary factors that determine this are the sun protection factor (SPF) of the sunscreen and activity which can remove the sunscreen or degrade the SPF. The rule of thumb for SPF is that the SPF rating is the multiplyer of how long you can be in the sun without burning as compared to no sunscreen. That of course varies by individual skin type. Those with fair skin may burn with only a few minutes exposure while others may be able to tolerate considerably more. For example, for someone whose skin begins to burn after 20 minutes of exposure without sunscreen, a sunscreen with an SPF of 15 should be applied every 5 hours (15X20/60).
However, regardless of the SPF number, sweating, swimming, showering, etc. remove sunscreen and/or cause the SPF value to degrade. Even sunscreens that are water resistant or waterproof begin to degrade in water after 40 or 80 minutes respectively.