From Hamlet's departure for England to his being taken by pirates: one day.

Revealed in Hamlet's letter to Horatio, delivered by the pirates: (4.6.15)

"Ere we were two days old at sea, a pirate of very warlike appointment gave us chase."