Hilchot Shabbat 2:22-23 (Losing track of which day is Shabbat)
10:32 pm
If a person is lost and cannot remember which day is Shabbat, what should he do? Is he allowed to do work on any day, given that each may, in fact, be Shabbat? And if an army attacks a city but only to take the city’s money, can the populace fight back on Shabbat?