This question already has an answer here:
This has been another issue I continuously wonder about, when people are just about to offer prayer or when they enter a Mosque they put on hats similar to the one in the picture below:
- What's its purpose? (Is it some sort of Hasanat booster)?
- Is there any narraration about specific dresses for prayer (Although I know that there is no Islamic dress as long as the dress is compliant with the Islamic teaching i.e. covering the awrah)
If you believe that wearing the hat is Sunnah or mandatory than please provide the relative evidence!
Also take into consideration the environment the prophet PBUH, where a hat may have been used as a form of protection from sun rays!