It is forbidden for a mourner, God forbid, to shave or take a haircut during the period of Sheloshim – the first thirty days of mourning. These thirty days begin from the day of the burial, even if the burial took place a day or several days after the death. The day of the burial counts as the first day, and the mourner may shave and take a haircut on the thirtieth day.
This applies, however, only to those mourning the passing of immediate relatives other than parents. In the case of a parent’s passing, one may not shave or take a haircut until the 31st day and "Ge’ara" (literally, "scolding") – meaning, he is told by his peers that he is unkempt and needs to shave or cut his hair. Thus, a mourner after a parent’s death may shave and cut his hair only after two conditions are met: he has reached the 31st day since the burial, and he was "scolded" for his unkempt appearance.
It is permissible for a mourner to comb his hair during Sheloshim; this prohibition applies only to shaving and haircutting.
It is our custom to conduct an Azkara service upon the conclusion of the Sheloshim period, and again each year on the Yahrtzeit (the calendar date of the passing). The Ben Ish Hai (Rabbi Yosef Haim of Baghdad, 1833-1909) held, based on Kabbalistic sources, that the Azkara service is held on the thirtieth day since the burial, rather than the thirtieth day since the family member’s death. Therefore, with regard to both the grooming restrictions and calculating the day for the Azkara, we count thirty days starting from the day of the burial, and not from the day of death.
Summary: A mourner may not take a haircut or shave until the thirtieth day since the day of the family member’s burial, even if the death occurred a day or several days earlier. In the case of a parent’s passing, he must also wait until until 31st day and when somebody tells him he looks unkempt. The Azkara service is held on that same day – the thirtieth day since the family member’s burial, even if that is not the day of death.