There are various ways to express time in Latin.
1) The first option is with a preposition or adverb. For example:
post multos dies - after many days
abhinc tres dies - three days ago
ante primam lucem - before dawn
In each of these examples the preposition/adverb used (post, abhinc, ante) governs a specific case which affects the declension of the words used.
2) If no preposition or adverb is used, the case determines the meaning:
a) The accusative case usually indicates 'how long' something lasts, translated by 'for'. For example,
Graeci Troiam decem annos obsidebant - The Greeks besieged Troy for ten years.
tres dies apud Sextum manebam - I was staying with Sextus for three days.
b) The ablative case indicated 'when' or the period 'within which' something happens. This is often translated by the words 'at', 'on' or 'in', based on context and the verbs in the sentence. For example,
prima luce profecti sumus - We will set out at dawn
octo diebus rus redibo - On the eighth day I shall return to the country.