Hammurabi's code dates to about 1790 BC, Moses lived around 1300-1250 BC, so Hammurabi's code is much older.
The Code of Hammurabi was developed during the reign of Hammurabi (1792-1750 BC) of the 1st dynasty of Babylon. It consists of his legal decisions that were collected toward the end of his reign and inscribed in Babylon's temple of Marduk, the national god of Babylonia. There are 282 case laws which include economic provisions, family law, as well as criminal law and civil law.
The Ten Commandments was given to Moses around 1445 BC.
The Ten Commandments was given to Moses around 1445 BC.