CNBC and the Republican presidential candidates agreed Friday on the format for the third debate, a day after Donald Trump and Ben Carson threatened to boycott unless they got their way, the network said.

The Oct. 28 debate will be two hours long and include closing statements from the participating candidates, said Brian Steel, CNBC spokesman.

In a joint letter to CNBC's Washington bureau chief Thursday, the billionaire businessman and retired neurosurgeon told the hosting network they would not appear at the Oct. 28 debate unless it was capped at two hours including commercials and the candidates were allowed to speak directly to the camera at its opening and close. The Republican National Committee and candidates began discussing the format on Wednesday, Republican National Committee spokesman Sean Spicer said.

CNBC had proposed two hours of debating time not including four commercial breaks, meaning the actual time the candidates would be onstage would be some 15 minutes longer.

The most recent debate, on CNN, lasted three hours with commercial breaks, a duration that left some of the candidates complaining. Since the debates have set records for high ratings, television networks have an incentive to keep the candidates onstage and on the air for as long as they possibly can.

CNBC had also initially called for no opening and closing statements, which made some candidates unhappy because it would take away their best chance to speak directly to voters without having to be called on to respond to a question.

Spicer confirmed the agreement. RNC Chairman Reince Prebius said there would be an open-ended question to all of the candidates at the beginning.

Debate format squabbles are common in presidential campaigns, an issue magnified this year because of the number of candidates running and their popularity as television events. Trump had threatened not to appear on the second GOP debate on CNN unless the network made a $10 million donation to charity; no donation was made and Trump appeared.

(Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)