Donald Trump has said he will end the war before taking office in January should he win the U.S. election in November.