Resting

The rules for taking both long and short rests vary depending upon the environment you are in.

Settlements

While in established settlements with safe lodgings, a short rest takes 1 hour and a long rest takes 8 hours.

Wilderness

While in wilderness regions, or without access to safe lodgings, a short rest takes 8 hours, and a long rest takes 24 hours.
Additionally, while taking a long rest, the party may attempt to establish a camp. Establishing a camp requires Survival checks from involved players, which takes 1 hour to perform. The Survival checks are added together and compared to the cumulative DC. The DC is simply equal to the number of players the camp is designed for multiplied by the per-player camping DC, which is determined according to the listed hazards.
Hazard
DC Modifier
Light precipitation2
Heavy precipitation4
Extreme temperature2
Extreme winds3
The per-player camping DC is equal to 5 + the sum of the relevant hazard DC modifiers. For example, a group of 3 adventurers camping in a windy environment with light precipitation would have a camping DC of 3 * (5 + 2 + 3), or 30. Each day of resting, each member of the party may make Survival checks, subtracting their result from the remaining camping DC. Players may repeat this check once per day, until the DC is reached.
When the camping DC is reduced to 0, the party has access to a camp. For the purposes of resting, the camp is considered safe lodgings for the players, allowing them to take short rests in 1 hour and long rests in 8 hours. This benefit is only conveyed after the first long rest during which the players create the camp.

Sleeping

For every 24 hours, at least 6 hours of them must be spent sleeping. Characters who fail to sleep at least 6 hours in a day gain a level of exhaustion.

Resources

Resources expended while resting, such as spell slots, or hit points, are not regained at the end of the rest.