Hats help to keep you cool that means that your body temperature does not rise excessively which help to keep you hydrated. Thus, wearing a hat and protecting especially your head and face from the sun will help to keep you cooler and it is likely that you will need less water than without a hat.