The accusative case is used for definite time expressions
without a preposition, e.g.
masculine: der Monat -> jeden Monat (every month); letzten
Monat (last month)
feminine: die Woche -> nächste Woche (next week); letzte
Woche (last week)
neuter: das Jahr -> letztes Jahr (last year); nächstes Jahr
(next year)
in einem Jahr (in one year) or vor einer Woche (one week
ago) are examples of definite time expressions with a preposition;
then the
preposition
determines the case.