The record date is used as the day when the company will use the share register as a guide to who is entitled to whatever action the company is taking (usually paying a dividend).

When a company declares a dividend they will announce a record date two days after the XD date. Any trades that took place around the XD date will be reflected in the share register by then.