Beach :Standard swim trunks (optimal length the same as for shorts) or board-shorts are the way to go, like Jake Gyllenhaal has chosen in the photo.
More tips found in Shorts, and General Fashion Theory
More event-specific tips: First Date , Formal Occassions and Clubbing
[Events]
"Art may make a suit of clothes: but nature must produce a man."
David Hume