William McKinley ( January 29 , 1843 â `` September 14 , 1901 ) was the 25th President of the United States , from 1897 until his assassination in 1901 . William McKinley , Jr. ( January 29 , 1843 - September 14 , 1901 ) was the 25th President of the United States ( 1897 â `` 1901 ) , and the last veteran of the American Civil War to be elected to that office .