title: how can I show the date and time a user has used a textarea (saved with local storage onclick)?
body: <p>I am working on a textarea that saves to local storage on a button press. It also displays a pop up alert when something is saved or the textarea is visited. I also want it to display the date it was last updated or modified. How do I do that?</p>
  
  <p>Here is the code :</p>
  
  <pre><code>&lt;textarea id="box" style="margin-    bottom: 4px; width: 250px; height:     20px"&gt;
  &lt;/textarea&gt;
  &lt;br /&gt;
  &lt;button id="save"&gt;Save&lt;/button&gt;
  
  
  
  &lt;script type="text/javascript"&gt;//  check if "user" is in localStorage
  
  if (localStorage["box"])
  {
  var user = localStorage["box"] ;
  document.getElementById("box").    value = user ;
  alert("Welcome Back.")
  }
  else
  {
  document.getElementById("box").    placeholder = "Type here..." ;
      console.log("user not found in    localStorage") }
  
  //save entered gmail address
  document.   getElementById("save").  addEventListener("click", function ()
  {
      var user = document.    getElementById("box").value ;
      //localStorage["box"] = user ;
      localStorage.setItem("box",    box) ;
      alert("The text has been saved.   ") ;
      console.log("The text has been    saved")
      } , false);&lt;/script&gt;
  </code></pre>
  
  <p>I've found how to display the last modified date using timestamp. Here :</p>
  
  <pre><code>            &lt;script type="text/javascript"&gt;
                 (function() {
  
  
  
  try {
  
      (window.localStorage.getItem) /   / will throw in Firefox under some settings
  } catch (e) {
  
      return; // quit because dom.   storage.enabled is false
      }
  
  
  
      var area = document.    querySelector('#ta');
  
    // place content from previous     edit
    if (!area.value) {
  
        area.value = window.  localStorage.getItem('value');
  
    }
  
    updateLog(false);
  
  
  
    // your content will be saved   locally
     document.querySelector('#ta').   addEventListener('keyup',   function() {
  
        window.localStorage.  setItem('value', area.value);
  
        window.localStorage.  setItem('timestamp', (new Date()).  getTime());
  
      updateLog(true);
  
    }, false);
  
  
  
    function updateLog(new_save) {
  
        var log = document.  querySelector("#ta-log");
  
        var delta = 0;
  
        if (window.localStorage.  getItem('value')) {
  
            delta = ((new Date()).  getTime() - (new Date()).  setTime(window.localStorage.getItem('timestamp'))) / 1000;
  
            if (new_save) {
  
                log.textContent = 'Saved.   ';
  
                setTimeout(function() {
  
                    log.textContent = '';
  
                }, 3000);
  
            } else {
  
                log.textContent = 'last   saved: ' + delta + 's ago';
  
            }
  
        }
  
     } })(); 
  </code></pre>
  
  <p>But instead of  minutes, seconds, and nanoseconds I want to show the actual date and time.</p>
  
  <p>Ex. Turn 5:30:20 to Sun, September 22, 2013 5:59PM.</p>
  
  <p>Any help?
  Is it understandable?</p>