Two different versions of this quote appear in J.R.R. Tolkien's The Lord of the Rings trilogy. The first is in "The Fellowship of the Ring," book 1, chapter 2, in which Gandalf is speaking to Frodo directly. The second, which I have quoted here, is in "The Two Towers," book 4, chapter 1; in this instance, Frodo is remembering the conversation with Gandalf and, clearly, his memory gives him a slightly different — and to my thinking, more powerful — wording. See this very interesting article that discusses this topic:
http://www.thetolkienist.com/2013/06/23/middle-earth-and-modernity-part-1-dont-deal-out-death-in-judgment/