Eating habits affect skin's protection against sun. Sunbathers may want to avoid midnight snacks before catching some rays, new research recommends. A study in mice shows that eating at abnormal times disrupts the biological clock of the skin, including the daytime potency of an enzyme that protects against the sun’s harmful ultraviolet radiation. Source 8h.
A persons skin color has a lot to do with the protection they have from the sun too. If you are lighter skinned making sure you put on sun screen will also help protect you from harmful sun rays. Even if you have darker skin you can still get sun burned so yes making sure you are protected from the sun helps besides your eating habits.
Yeah, I have a nice Mediterranean skin tone, that's right ladies, and I can get burned pretty good depending on where I am. It usually takes a while in the sun until I'm dark enough to go without protection… and I still wear it for safety's sake.