At the beginning of the book, he was a few days to 17. A few days after his arrival at the Burrow, he turned 17 and legally became an adult. By the end of the book, he, Ron, and Hermione (and others in his year, like Neville and Malfoy) are 37.
參考: Me, Harry Potter and the Deathly Hallows by Joanne K. Rowling