Parse localStorage Item to date - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window localStorage

Description

Parse localStorage Item to date

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w w w.j a  v a 2  s .  c om
var date= new Date();
  //setting item
  localStorage.setItem('dateIs', date);
  //retrieving item from local storage
  var newDate = new Date(localStorage.getItem('dateIs'));
  console.log(newDate);
  
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials