Moodle assignments can be used for timed take-home exams, by using the time limit feature in the Availability section of the Assignment settings. This works best for open-ended questions in which you would like students to submit a file.
It is also possible to use a quiz for a timed exam. See Creating a timed quiz or exam in Moodle. A timed assignment is easier to set up and grade if you want students to submit a single file. A timed quiz has more functionality if you want to include auto-graded questions (e.g. multiple choice or fill in the blank) or would like to grade several short essays.
Start by creating an assignment (see Set up an assignment in Moodle for more guidance).
In the Activity instructions, end the information students need to know to take the exam. For example, this could include an essay prompt or you could upload a file with a copy of the exam instructions. Students will not be able to see the activity instructions until they begin the exam.
Under the Availability section, adjust the Allow submissions from and Due date to be the start and end of the window of time students are allowed to take the exam. Then set the Time limit to the desired maximum time that students can work on the exam.
All other standard Moodle assignment settings can be implemented as you see fit. Just like a normal assignment, it is possible to set up individual user or group overrides to adjust the window that the exam is open or to provide extended time.
Students can make a submission after the time expires and their submission will have a note indicating it was turned in late.