Depends on injury
When you have a blunt trauma to the scalp it can be painful for a few days to a week getting better each day.
There might be swelling, or a hematoma (bleeding under the skin) which can further prolong the pain. Obviously minor trauma will heal faster than major. Ice can help reduce the swelling, a hematoma is usually self limited and will resolve over time. If concerned go have it checked.