Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Correct expiration date format for cookies

by Anonymous Monk
on Aug 14, 2006 at 07:30 UTC ( #567163=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks!

This question doesn't really have a lot to do with Perl, but I am using Perl so I hope it's permissible to ask this here.

I am writing a Perl CGI program, which uses cookies, and I was just wondering what the correct way to format the expiration date is. When I use google and some books that I have, all of the answers are different. I gather that most browsers will accept several formats without complaint, but what is the official one?
  • Comment on Correct expiration date format for cookies

Replies are listed 'Best First'.
Re: Correct expiration date format for cookies
by davorg (Chancellor) on Aug 14, 2006 at 07:44 UTC

    The documentation for's "header" method contains an example of the format required - Thursday, 25-Apr-1999 00:40:33 GMT. But it's usually easier to use one of the abbreviated formats like '+1d' or '+1y'.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Correct expiration date format for cookies
by Tomte (Priest) on Aug 14, 2006 at 08:30 UTC

    According to the RFC 2965 Max-Age for a cookie is expressed as positive integer with the meaning "seconds from now on" - in difference to the cache-controling expiration header, which has to follow the date-formats specified in RFC 2616, of which the format mentioned in the is one.


    An intellectual is someone whose mind watches itself.
    -- Albert Camus

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://567163]
Approved by McDarren
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2021-12-01 22:32 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (15 votes). Check out past polls.