The gravedigger reveals this in his conversation with Hamlet: (5.1.56-100). All the edited texts take their wording from the Second Quarto edition:
Hamlet: How long hast thou been a grave-maker?
Gravedigger: I came tot that day that our last king Hamlet overcame Fortinbras It was that very day that young Hamlet was born I have been sexton here man and boy thirty years .this skull hat lien you ithearth three-and-twenty years .this same skull, sir, was, sir, Yoricks skull
Hamlet: He hath borne me on his back a thousand times those lips that I have kissed I know not how oft .
In the First Folio edition, though, the line reads "I have bin sixeteen heere..." (See Chapter One, and many contemporary "sixeteene" usages here.)
In the First Quarto edition, "I have been sexton here man and boy thirty years" is missing, and the gravedigger says instead of 23 years, "heres a scull hath been here this dozen year." : (Q1: 3361)