How to set this cookie to expire in one hour from the current time:
document.cookie = 'username=' + value; + 'expires=' + WHAT GOES HERE?; + 'path = /';
How to set this cookie to expire in one hour from the current time:
document.cookie = 'username=' + value; + 'expires=' + WHAT GOES HERE?; + 'path = /';
Instead of using expires, you can use max-age. Max-Age takes presence over expires and accepts an expiration duration in seconds.
For your example, considering an hour is 3600 seconds, the code would be:
document.cookie = 'username=' + value + '; max-age=3600; path=/';