Bonjour!
This is an interesting topic and RobertC106 has covered it pretty well, but I thought I'd build upon it. RobertC106 is completely right in saying:
En + time/duration expresses the time required.
Dans + time/duration expresses the time until.
There is another trick to distinguish when to use these two prepositions. Both prepositions can be used to express a point in time, however one is in the future and one is in the past.
Dans is used to express a point in time, however this is used in the future tense for an action that is anticipated to start in a certain amount of time.
- Je le ferai dans dix minutes. (I will do it in ten minutes.)
i.e. the action will begin in 10 minutes time.
En is used to express a point in time and generally speaking that is expressed in the past tense. For example:
- Je l'ai fait en dix minutes. (I did it in ten minutes.)
i.e. the action was completed in 10 minutes.
We can do a direct comparison to see the difference. Imagine someone asks you to complete a task, you could say:
- Là, j'ai pas le temps, je le fais dans dix minutes. Mais c'est vite fait, je le fait en dix minutes.
- Right now, I don't have time, I'll do it in ten minutes. But it's quick, it'll take me ten minutes.
Note how the first sentence describes that the action will commence in the future (dans), while the second sentence describes how long it will take to complete the action.
I hope this helps,
- Mitchell