I'm getting severe sharp head and neck pains when in the sun, what is this caused by?

Migraine. This could be a migraine, but best be checked out by a neurologist.
Sun related Migraine. Sun is a source of many a wonderful things, including headaches! Pl see attached link for more general info on effects of sun, especially when the UV lights is brighter. Pl make sure you use sun protection with SPF greater than 30 and drink lots of water to avoid dehydration. Feel better!