Barack Obama served for at least two years in office.
Barack Hussein Obama II ( [ bəˈrɑːk_huːˈseɪn_oʊˈbɑːmə ] ; born August 4 , 1961 ) is an American politician who served as the 44th President of the United States from 2009 to 2017 . He previously served in the U.S. Senate representing Illinois from 2005 to 2008 , and in the Illinois State Senate from 1997 to 2004 . Obama represented the 13th District for three terms in the Illinois Senate from 1997 to 2004 , when he ran for the U.S. Senate . Barack Obama served as the 44th President of the United States from 2009 to 2017 .