Since Purim is celebrated in unwalled cities on the fourteenth and in walled cities (today, only in Jerusalem) on the fifteenth, many questions arise regarding one who travels from an unwalled city to Jerusalem, or vice versa. When should such a person observe the holiday of Purim? The general rule is that a person’s obligation is determined by his location on the day of Purim, not by his permanent residence throughout the year, because one who stays in an unwalled city for even one day is nonetheless considered a resident of an unwalled city with respect to the laws of Purim. The determining moment is alot ha-shaĥar (dawn) – on the fourteenth for unwalled cities, and on the fifteenth for walled cities – because that is when the obligation of the daytime Megilla reading begins.
A resident of Jerusalem who wants to celebrate Purim on the fourteenth must enter an unwalled city on or before the night of the fourteenth and remain there until after alot ha-shaĥar. This way, he is considered a resident of an unwalled city according to all opinions. Then, even if he returns to Jerusalem early in the morning, before managing to read the Megilla, he remains obligated to read the Megilla on that day – the fourteenth – in Jerusalem. In such a case, he should appoint someone who is staying in an unwalled city to be his shali’aĥ to give matanot la-evyonim and mishlo’aĥ manot on his behalf. If, on the other hand, a resident of Jerusalem enters an unwalled city on the night of the fourteenth with intention to return to Jerusalem before alot ha-shaĥar of the fourteenth, or if he first enters the unwalled city after alot ha-shaĥar of the fourteenth, and he returns later on to Jerusalem, he is still considered a resident of Jerusalem, because the determining time is alot ha-shaĥar of the fourteenth.
If a resident of an unwalled city celebrates Purim on the fourteenth and wants to celebrate the holiday again on the fifteenth, in Jerusalem, he must come to Jerusalem on the night of the fifteenth and stay there until after alot ha-shaĥar of the fifteenth. This way, he is considered a resident of Jerusalem for the day and must fulfill all the mitzvot of Purim on the fifteenth. However, he should try to hear the berakhot for the Megilla from someone else – and if he reads the Megilla for himself, he should omit the berakhot altogether – because some authorities maintain that one who already observed Purim on the fourteenth does not need to observe it a second time (based on Rosh). Even though he is halakhically required to observe Purim on the fifteenth as well, when it comes to reciting the berakhot, we take into account the opinion of those who rule that he is exempt and therefore omit the berakhot. One who is going to be in Jerusalem from the night of the fourteenth all the way through the day of the fifteenth must observe Purim only in Jerusalem, and he may recite the berakhot over the Megilla on the fifteenth according to all opinions.
The Rishonim debate the case of a resident of Jerusalem who traveled to an unwalled city on the night of the fourteenth and planned to return to Jerusalem before alot ha-shaĥar, but was delayed and did not manage to return in time. Some authorities maintain that his status is determined by his intentions, and thus he is exempt from observing Purim on the fourteenth (Rif, Ramban). Others maintain that we consider only his actions, and thus he must observe Purim on the fourteenth (Rashi, Ha-ma’or). Within the opinion that his status is determined by his intentions, some maintain that his status is determined by his intention at the time that he traveled to that location (Mishna Berura), and others maintain that his status is determined by his intention when Purim begins. In practice, in both cases one should observe the mitzvot of Purim without reciting berakhot. If added uncertainties arise, one should consult a competent rabbi.
The determining time is alot ha-shaĥar because that is when the obligation for the daytime Megilla reading – which is the primary reading – begins. Several poskim write that halakha actually implies that in order to become obligated, one must stay there long enough after alot ha-shaĥar to be able to read the Megilla, which is approximately half an hour (see sht 688:17).
I wrote in the main text that the determining time is alot ha-shaĥar of the fourteenth and of the fifteenth, as that is the opinion of Rashi, Ramban, Ritva, Ri’az, sa, and others. Rosh, however, maintains that alot ha-shaĥar of the fourteenth is the only determinant. Accordingly, one can never obligate himself to observe two Purims. In consideration of his opinion, one does not recite the berakhot over the Megilla reading on the second day. Furthermore, according to most poskim, based on the Yerushalmi, it turns out that one who will be in Jerusalem on the fourteenth and in Tel Aviv on the fifteenth is exempt from observing Purim altogether. According to Rosh, however, since he knows on the night of the fourteenth that he does not intend to be in Jerusalem on the fifteenth, he must observe Purim on the fourteenth, and some say on the fifteenth as well.