Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

having problem setting cookie date 2

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
Hi,

I am setting the date for 19th, like the following

Code:
document.cookie = cookieNameOffer+"="+escape(cookieValueOffer) + ";path=/"
                 + ";expires=19/02/2009 00:00:00"

But when i go the cookie I see the following date, what I am doing wrong here?

Wednesday, February 18, 2009 7:00:00 PM
 
Well, I'd guess you've got a GMT conversion to local time (I'd guess EST).

_________________
Bob Rashkin
 
Why have you changed the date formatting from the code you've had in previous posts? In those you specified the date had to be a GMT string. Why change it?

Anyway - try putting it back to what you had previously:

Code:
"Thu, 19 Feb 2009 00:00:00 GMT"

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
I put the following

document.cookie = cookieNameOffer+"="+escape(cookieValueOffer) + ";path=/"
+ ";expires=Fri, 20 Feb 2009 00:00:00 GMT"


But when I look in firefox, my cookie expiry date is
Thursday, February 19, 2009 7:00:00 PM
 
So, and not to belabor the point, if you want it to be midnight your time, you need to set it to 5:00am the next day.

_________________
Bob Rashkin
 
does the browser pick up time from the computer or it has its on time zone settings?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top