Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q889 What happens to cookie expiry dates after 31st December 1999?

irt.org | Knowledge Base | JavaScript | Cookie | Q889 [ previous next ]

Q889 What happens to cookie expiry dates after 31st December 1999?

Take a look at http://www.netscape.com/newsref/std/cookie_spec.html which specifies that the expiry date should use 4 digit dates. If you are using two digit dates then you'll hit a y2k problem. To ensure that you are using a full four digit date use the robust y2k() JavaScript function when extracting the year from a date object:

<script language="JavaScript"><!--
function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var now = new Date();

year = y2k(now.getYear());
//--></script>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.