How to detect sunshine on a photo
If you can access the meta-data you could apply a number of heuristics:


Check the white-balance setting, the camera has chosen for the photo. Basically it indicates the color temperature of the light at the time the photo was taken. Usually sunlight is around 5500 Kelvin. Indoor lighting or cloudy days, usually have different temperatures.
Check the exposure settings. Usually when the sun shines, there is more light available, so this influences the following settings:


A lower shutter speed
A lower ISO setting
A higher f-value


In the old days of photography, the Sunny 16 rule was used to estimate exposure. And you could use it, together with the information in the list above, to check if the photo was taken during the day.
Check if a flash fired or not.
Check the time the photo was taken. Assuming the user has configured the clock, you might immediately remove photos shot at night. 


If however you want to approach this problem simply from an image-processing point of view. I can say that sunlight has usually higher contrast, and harsher edges. Therefore histogram analysis and finding harsh edges might give a good indication.

Assuming the photos you are processing are in a Raw Image Format you could apply the same white-balance trick described above. This however does not work for standard images like jpeg or png. This because the image processor on the camera already compensates for the shift in color temperature, and bakes the result into the final image, merely recording the wb-setting it in the metadata.