The proper date format for expires
is something like this:
Mon, 19 Nov 2012 15:40:59 GMT
That format can be obtained with this snippet:
str_replace('+0000', 'GMT', gmdate('r'));
Or:
gmdate('D, d M Y H:i:s T');
Expiry date of 30 days in the future can be done with:
$expires = str_replace('+0000', 'GMT', gmdate('r', strtotime('+30 days')));
The max-age
can be used to specify (in seconds) when the cookie should expire; this is not portable between all browsers though, as explained here.