LONDON (Reuters) - Britain is due to appoint a new prime minister and attempt to renegotiate the terms of its Brexit deal, all before Oct. 31, when it is scheduled to leave the European Union.

What are the key dates between now and Brexit day?

LEADERSHIP CONTEST

The ruling Conservative Party is in the process of selecting a new leader, who will replace Theresa May as prime minister and head of the party.

There are two remaining candidates for the job: Jeremy Hunt and Boris Johnson. [nL8N23V2MG]

The winner will be selected by a postal ballot of around 160,000 Conservative Party members.

JULY 22 - Voting closes at 1600 GMT.

JULY 23 - The new leader will be announced.

Details of the announcement have yet to be released but a fundraising email from the Conservative Party to members suggested it would be around 1000 GMT in London.

The winner is likely to make a speech after the announcement.

JULY 24 - May will hand over power to her successor.

After 1000 GMT - May is due to depart from her Downing Street office and travel to parliament.

1100 GMT - As prime minister, she will host her final question and answer session in parliament.

1200 GMT - May is expected to return to Downing Street.

Approx 1300 GMT - May will travel to see Queen Elizabeth at Buckingham Palace and formally stand down.

Approx 1500 GMT - The new prime minister travels to visit the queen and is asked to form a government. He is then expected to enter Downing Street.

No details of plans for that day have been announced, but they could include a speech in Downing Street and the naming of some senior cabinet positions.

PARLIAMENT

The new prime minister could face an immediate test of their ability to govern. The opposition Labour Party could bring forward a motion of no confidence. To survive, the prime minister would need to win a vote in parliament.

If a government loses a vote of confidence, there are 14 days in which it can try to win another vote or an election is triggered.

JULY 25 - Parliament is due to break up for its summer recess. If a no confidence vote were to be held before lawmakers leave for their summer break, it would have to take place on this day.

SEPT. 3 - Parliament is scheduled to resume for a short session which typically lasts around two weeks before there is another break while the political parties hold their annual conferences. The exact length of this session has not been announced.

SEPT. 21 -25 - The opposition Labour Party holds its annual conference.

SEPT. 29 to OCT. 2 - The Conservative Party holds its annual conference.

EARLY/MID-OCTOBER - Parliament resumes following the party conferences. The exact dates for this session have not been announced.

Under existing British law, any new Brexit deal would need approval by parliament before it can be ratified.

OCT. 31 - Britain is due to leave the European Union.