title: Set cookie to expire in 24 hours
body: <p>A form has the following code to prevent multiple form submissions:</p>
  
  <pre><code>function AllowNoDups() { var cookie_ls = document.cookie; if (cookie_ls.indexOf(document.location) &gt; -1) {
    alert("You've already submitted a free meter request. Thank you for your interest!  ");
    return false; } else { document.cookie = 'username=' + value; + 'expires=' + var now = new Date(); var time = now.getTime(); time += 3600 * 1000; now.setTime(time); document.cookie = 'username=' + value + '; expires=' + now.toGMTString() + '; path=/';; + 'path = /' document.cookie =  "; path=/newform.php; expires=Sun, 1-Jan-2040 00:00:01 GMT;"; return true;};};
  </code></pre>
  
  <p>While the code works, I would rather set the cookie to expire after 24 hours have elapsed, as opposed to specifying a date at which the cookie would expire. How would I go about accomplishing this? Thank you!</p>