Many payroll checks include a "restrictive legend" that asks the bank not to cash the check if it is older than a certain amount of days. In this case, you should cash it before this expiry date to avoid any hassles.
Whatever the Expiration Date Says
Banks May Honor Check After Expiration Date
In general, all checks become stale after six months. However, state law may require that banks honor any payroll claim, even if the date on the restrictive legend has passed. In addition, banks typically do not look at the date on a check, so it will likely get cashed.
Banks can cash a check at any time so long as they do not have reason to look at the date and see if it is six months old, but you should still cash your payroll checks immediately. Companies usually include an expiration date on their payments, so they do not have too many withdrawals at once. If you have an expired payroll check, you could ask the employer for a new one. However, keep in mind that, just because an employer puts an expiration date on the check, this does not mean the bank must honor it.