Niall Horan just proved the saying to be true ... when you gotta go, you gotta go.
The One Direction singer was out with a group of friends in West Hollywood Friday night when nature called. That's when Horan made a quick jog to an empty parking lot to drain the main vein.
Lucky for Niall ... no cops caught him ... public urination usually carries a punishment of a small fine and community service in California.
Giving a whole new meaning to "Midnight Memories."