Four months from the murder to the mousetrap.

Ophelia tells us this in her banter with Hamlet before the play: (3.2.82)

Hamlet: …my father died within’s two hours.

Ophelia: Nay, ‘tis twice two months, my lord.