var date=new Date();
Now, I need to set cookies to expire after a specific number of hours, minutes or seconds. Can you please give me advice how to do it ?
To set a cookie expiring in specific amount of hours, minutes and seconds, you can use the solution below. The cookie will expire in 1 hour, 5 minutes and 30 seconds. Expiration time is set in seconds - 3930. You can modifiy the expiration time according to your needs.
var date = new Date();
var expiry = '; expires=' + date.toUTCString();
document.cookie = 'abc=123'+expiry+'; path=/';
|Best battery saving tips - How to save battery on Phone or Tablet|
|How to calculate inverse currency exchange rate ?|
|How to add side by side rows in excel pivot table ?|
|Remove or hide bottom navigation bar with buttons on Android|
|How to change QWERTZ keyboard to QWERTY in Windows 10 ?|
|Samsung Galaxy A & F better than M series ? What's the difference ?|
|Free email accounts with large or unlimited storage capacity|