Parse localStorage Item to date - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window localStorage


Parse localStorage Item to date

Demo Code

ResultView the demo in separate window

      <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'));


Related Tutorials