To express for how long you do/did/will do something in Spanish you do not need to use any prepositions if there is an explicit lengh of time phrase (e.g. dos días, seis horas, un mes, cuatro años...)
Here are some examples:
However, the prepositions "durante" and "por" can also be used:
Bear in mind that durante is more frequently used than por.
Want to make sure your Spanish sounds confident? We’ll map your knowledge and give you free lessons to focus on your gaps and mistakes. Start your Brainmap today »