Why Must the Block Timestamp Be within a Certain Range of the Network Time?

The block timestamp must be close to the actual current time (usually within a few hours of the median time of the last 11 blocks) to prevent miners from manipulating the difficulty adjustment or creating blocks with future timestamps to gain an unfair advantage. Nodes will reject blocks with timestamps that are too far into the future or the past.

What Is the Role of ‘Difficulty Adjustment’ in Proof-of-Work?
How Does a ‘Difficulty Adjustment’ Maintain a Consistent Block Time?
What Specific Formula Is Used to Calculate the Bitcoin Mining Difficulty Adjustment?
How Do Time Stamps in Block Headers Help Secure the Chain?
How Does the Difficulty Adjustment Prevent a “Mining Death Spiral”?
What Is a ‘Negative Difficulty Adjustment’ and What Causes It?
How Is the Difficulty Adjustment Mechanism a Defense against a Rapid Hashrate Drop?
How Does the Difficulty Adjustment Mechanism Affect the Attack Cost over Time?

Glossar