Friedrich Nietzsche said this quote

He who has a why to live can bear almost any how.