I have java script, i used it for create cookie and i want to exipre it in 5hours but minimum expire time is one day..Can any one help me to turn this code to expire cookies in minutes/hours? I tried but I failed.Help me..
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
username='20';
setCookie("username",username,1);
1 is for one day,how to make it expiries in 5 hours?
I didn’t try. I hope it will work.