Answer:
876 years (for the pyramids of Saqqara, the earliest known Egyptian pyramids)
Step-by-step explanation:
Hammurabi's code dates to about 1754 BC, back in ancient Mesopotamia. However, as for the pyramids there are over 100 identified Egyptian pyramids, that date from very different times. For the purposes of this question, let's use the most ancient pyramids known today, the Saqqara pyramids. These are estimated to have been built between 2630 BC and 2610 BC. This means that 876 years passed since the start of construction of the Saqqara pyramids and the carving of the Hammurabi code.