"Persistence! Keep putting it back on. Let them choose their own hat. Explain that no hat=no outdoor fun and follow through with the threat if they refuse to wear it."
"Just keep trying. One of my boys always pulled his baseball cap off but was fine with a fisherman style sun hat, so you could just try a different style, or maybe let him choose."
"In time he will probably get used to it or if you keep putting it back on he will give up! Getting one with a character one that he likes will help x"
"Haha exactly like my 19 month old to a T!! When you find out, let me know because I've tried everything, even distracting him with something else. That only works for a few minutes though :-("