Taking baby out in the sun

I see a lot of friends with their 2-3 month old babies out with nothing protecting their eyes or face from the sun? Is that okay to do? His pediatrician told me to make sure my baby has sunscreen and a hat on he’s almost 3 months... FTM