Dumbledore becomes Headmaster after serving as Transfiguration teacher for several decades. He replaces Armando Dippet.
The year of Dumbledore taking over as Headmaster from Professor Dippet can be deduced from two separate passages in the books.
The first passage indicates that Dumbledore became Headmaster no earlier than 1956 or 1957:
Voldemort spent some time working for Borgin and Burkes after leaving Hogwarts. Exactly how long is not revealed. Toward the end of that time, he murdered Hepzibah Smith. Then he vanished for a decade:
"And now for the very last recollection I have to show you, at least until you manage to retrieve Professor Slughorn's memory for us. Ten years separates Hokey’s memory and this one, ten years during which we can only guess at what Lord Voldemort was doing. . . ." Harry got to his feet once more as Dumbledore emptied the last memory into the Pensieve (HBP20).
When he returned to Hogwarts, his intention was to hide his Horcrux in the Room of Requirement. His cover story was to ask Dumbledore for a teaching post.
"Thank you," said Voldemort, and he took the seat to which Dumbledore had gestured — the very seat, by the looks of it, that Harry had just vacated in the present. "I heard that you had become headmaster," he said, and his voice was slightly higher and colder than it had been. "A worthy choice."
So Dumbledore became Headmaster at some point within a decade after Tom Riddle murdered Smith. If that murder took place, say, two years after Tom left Hogwarts in the summer of 1945, then the earliestDumbledore would have become Headmaster is 1956 or 1957.
However, another passage moves that date further along the timeline:
Lupin tells of being unable to attend Hogwarts because of his condition, but that this changed when Dumbledore became Headmaster:
"Before the Wolfsbane Potion was discovered, however, I became a fully fledged monster once a month. It seemed impossible that I would be able to come to Hogwarts. Other parents weren't likely to want their children exposed to me. But then Dumbledore became Headmaster, and he was sympathetic. He said that as long as we took certain precautions, there was no reason I shouldn't come to school...." (PA18).
Lupin was born in 1960 and was bitten shortly before his fifth birthday, which would have been in 1965. It is reasonable to assume that from that point on, Lyall and Hope Lupin would have been discussing the many difficulties they and their son faced because of his affliction. One thing they would have discussed was that Remus would not be allowed to attend Hogwarts because the current Headmaster wouldn't allow it. However, things changed, as indicated by the phrase "then Dumbledore because Headmaster." Therefore, we can assume that Dumbledore's promotion had to have happened no earlier than 1965, when the bite happened, and no later than 1970, when Lupin went to Hogwarts.
From this we can also make another deduction: that Riddle worked for Borgin and Burkes for around ten years. We are never told directly for how long Tom Riddle worked for the Knockturn Alley establishment. If he was their clerk for ten years, say from the mid-1940s through the mid-1950s and murder of Hepzibah Smith took place around 1956, then Dumbledore would have become Headmaster sometime after 1965 and the visit by Tom Riddle to ask for a teaching post could have happened at any point between then and 1970 when Lupin came to Hogwarts.