Praise be to Allaah.
If a person leaves Islam then decides to come back to it, what he has to do is to bear witness that there is no god except Allaah and that Muhammad is His slave and Messenger. If his apostasy was because he denied one of the basic principles of the religion, then his return to Islam cannot be complete until he affirms the principle that he had denied. There is no particular time period within which he can return to Islam; his repentance will be accepted until the point when the death-rattle sounds in his throat and his soul departs. If he is guided back to Islam within the time when it is possible (i.e., before death) and he performs as many of the Islamic duties as he can, then he is a Muslim.