As you can see on the picture, one question is used for two different cases but why?
That's a misleading way to represent it. Either когда should be on a total of four cases, or two but not these two, because the only time constructions without prepositions use genitive (пятого числа) and instrumental (ночью).
To sum up:
Genitive is used with dates (see above).
В+accusative is used with times (в пятнадцать часов) and weekdays (в субботу). It's also used with the word время.
Instrumental is used for seasons (весной, летом, осенью, зимой) and times of the day (утром, днём, вечером, ночью). Just these eight. Note that when you say днём it specifically means "in the afternoon" (or "in daytime" in the context of a simple day/night binary); "on that day" would be в тот день.
В+prepositional is used with months (в марте) and years (в две тысячи шестнадцатом году).
На+prepositional is used with the word "week": на прошлой/этой/следующей неделе.
Anything I forgot? К+dative is "by" some time, regardless of timescale — мне нужно это закончить к понедельнику "I need to finish this by Monday". But this and other minor idiomatics would be too much for now, I guess.
Well, that's because Accusative differs from Prepositional.
Accusative is about a whole range, while Prepositional is about "an interval somewhere in between limits". Thus short ranges require Accusative (normally you can't split a moment, anyway), and long ones - Prepositional.
Actually, English speakers also treat time periods differently. Though English lacks cases, but it has a few different prepositions for this work. Consider "at that moment" vs. "on that day" vs. "in that year". It's also possible that you could find some analogy in your native language too.
Surprisingly, but a day (likewise an hour, or a minute) in Russian is thought to be too short for "splitting", so we say "в субботу", but not "в субботе". Yet talking of month, one should finally switch to using Prepositional: "в январе", but not "в январь".
But note that there could be exceptions, for example:
В тот год осенняя погода
Стояла долго на дворе
Normal way of saying should be "в том году", but the author intentionally uses Accusative, so it sounds rather kind of "it was such a year..."
There are various prepositions used with time and date in English, and this doesn't follow any particular logic: why do we say "in March" but "on March 10th"? And why "at" 2 o'clock?
Russian is no different, various prepositions are used for various expressions, with the extra twist that grammatical cases are also involved. For instance:
- в понедельник, в субботу = on Monday, on Saturday (accusative singular)
- по понедельникам, по субботам = on Mondays, on Saturdays (dative plural)