When was James Madison President?

James Madison was the 4th President of the United States. He served in office from March 4th 1809 to March 4th 1817. Prior to being President, he was the 5th United States Secretary of State.