Update
I performed additional tests and came to the same conclusion as Issue 123013 listed below. I think this is just a DevTools bug.
DevTools > Network appears to incorrectly render the date. However, DevTools > Resources correctly displays the date similar to other browsers.
Also, another cookie I created correctly expired. This was reflected in DevTools > Resources but not in DevTools > Network. .
Test Results
setcookie('foo', 'bar', time()+3600, "/", NULL, false, true);
Chrome v24.0.1312.57
Resources > Cookies Thu, 14 Feb 2013 17:08:33 GMT
Network > Cookies Invalid Date
Firefox 18.0.2 Thursday, February 14, 2013 11:59:15 AM
IE9 9.0.8112.16421 Thu, 14-Feb-2013 17:06:42 GMT
Finally, to conclude, your syntax appears correct. The message "Invalid Date" looks like a Chrome bug.
I could not replicate this issue with Chrome v24.0.1312.57. I set various test cookies with JavaScript and PHP. Chrome threw no errors and correctly converted the max-age
values I passed into a corresponding expires
values.
This bug, or something very similar, has been submitted and apparently fixed.
WebKit
Chromium
Set-Cookie:
. Not that any browsers would complain of course... – Columnist