The longest-serving Prime Minister was Sir Robert Menzies, who served in office twice: from 26 April 1939 to 28 August 1941, and again from 19 December 1949 to 26 January 1966. In total Robert Menzies spent 18 years, 5 months and 12 days in office. He served under the United Australia Party and the Liberal Party respectively.