Neither of these is a well-formed, complete sentence.
__
The first ( when going to a party ) means it becomes dangerous to go to a party, it's time to think seriously about the situation.
__
The second ( when to go to a party ) means the time at which you go to a party .
It's a...