With the British Surrender at Yorktown, how long approximately did the war continue before it was officially ended by treaty?

History Trivia: With the British Surrender at Yorktown, how long approximately did the war continue before it was officially ended by treaty?