Is their something similar Napoleon said or is it entirely fictional?
The source for this is (as often!) the memoirs of Louis Antoine Fauvelet de Bourrienne, personal secretary of Napoléon from 1801 to 1813. They consist in 10 volumes packed with anecdotes that have been mined by historians since their publication in 1829. In Bourrienne's memoirs, the quote is attributed by Napoléon to his friend the General Desaix, who saved the battle at the last minute by leading his troops in a cavalry charge, but died in the process. Bourrienne (volume 4, p. 122):
The battle was regarded as lost, and indeed it was, for the First Consul having asked Desaix what he thought of it, this good and brave general answered him without boastfulness (jactance): "The battle is completely lost; but it is only two o'clock, we still have time to win one today." It was the First Consul who, that same evening, reported to me these simple and heroic words of Desaix.
It sounds a tad too perfect, right from a Greek epic or Hollywood movie when your heroes facing impossible odds give a cool-sounding pep talk ("We will fight in the shade", "We will not go quietly into the night!" etc.) but if one trusts Napoléon and his faithful Bourrienne, it's true.