I am using a cookie on my site to display colorbox one time on page load then after that the user has the option to manually load the colorbox each time. But what I do not understand is how you set the expiration date for the cookie. I got the needed code from another question here on SO and it would help if someone could explain to me what is what here.
var $j = jQuery.noConflict();
$j(document).ready(function(){
if (document.cookie.indexOf('visited=true') == -1)
{
var fifteenDays = 1000*60*60*24*15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$j.colorbox({ inline:true, href:"#gallery-nav-instruct"});
}
});
I would assume this means the cookie expires in 15 days. How would I change this to longer? Say 30 or 60 days?
The key thing to note here is
15 days each having 24 hours, each having 60 minutes, each having 60 seconds.
The last factor is 1000. so fitteenday variable is holding the number of milliseconds in 15 days.
This statement implies the expiration date of the cookie is whatever current date is plus 15 days.
So in your case when you want expiration of 15 or 30 days, you just need to replace 15 with however days you have in mind