Luckily, most prepositions are related to only one case - no matter the situation, they always require that case.
However, there are some so-called two-case prepositions - they sometimes use dative and other times use accusative, depending on the situation.
Here are the two-case prepositions: zwischen, auf, neben, vor, an, in, hinter, unter, über
Accusative: Question = Wohin?
The accusative is used when there is movement from point A to point B.
Dative: Question = Wo?
The dative is used when talking about one set location (no movement from A to B).
Everything about prepositions related to time: Temporal Prepositions
How to form questions with prepositions: Questions with Prepositions
Some verbs have prepositions complements: Verbs with Prepositions